Lesson 16: The while loop
NOTE: for a fast copy, follow these steps in order:
- Click anywhere in a text box below (result will be a blinking vertical line in the text box)
- Hit ctrl + A on the key board (the "ctrl + A" means hit Ctrl and A at the same time)
(The result should be that all the text inside the text box lights up in blue)
- Hit Ctrl + C (Nothing significantly happens that is visible) and now its copied to the clipboard and your ready to paste it anywhere you wish
beginning while loop examples |
This will print my name 5 times to the screen
This program code will count from 0 to 24
This program will NEVER END. This is a common bug called the infinite loop
This program will double the value of "a" and print it out to the screen until a is greater than 500
(NOTE: There is only 1 difference compared to the program above this one)
This program will dived a by 2 each time until a is 0;
No comments:
Post a Comment