Advertisement
front5stoneybaloney

do-while loops

Dec 20th, 2024
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. // Do loop:
  2. do
  3. {
  4.    // Body
  5. } while (condition);
  6.  
  7.  
  8.  
  9. // While loop:
  10. while (condition)
  11. {
  12.     // body
  13. }
  14.  
  15. The difference between while and do...while is that in the first case the body will never be executed if the condition is false to start with - whereas in the latter case it's always executed once before the condition is ever evaluated.
  16.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement