Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Syntax */
- while (expression) {
- // Statement(s) to be executed if expression is true
- }
- /* Example */
- var num = 6;
- var factorial = 1;
- while(num >=1) {
- factorial = factorial * num;
- num--;
- }
- print("The factorial is ${factorial}");
- /* Output
- The factorial is 720
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement