Advertisement
ipwxy

While Loops

Jun 29th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. While loops are simple. They accept a condition and repeatedly executes until the condition is false.
  2.  
  3. int number = 0;
  4.  
  5. while(number < 10) {
  6.  
  7. }
  8.  
  9. 1. The condition is checked first
  10. 2. If true, execute the code.
  11. 3. Repeat until condition is false
  12.  
  13. If we dont decrease the value stored in number, the loop will go on forever.
  14.  
  15. while(number < 10) {
  16. number++;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement