top of page

For Loops

For loops follow the syntax: for(initialize; condition; increment){ execute }

With for loops we can simplify some functions we would normally have to put in the body of a while loop. Two things we can do with for loops that we cannot do in the condition statement of a while loop includes initializing variables and doing programmatic incrementation. While the condition is met, the loop will continue to loop. The loop will not leave until it either no longer meets the condition or is told to break manually.

Example:

Output:

forloops1.png
forloops2.png
  • Twitter
  • LinkedIn
  • discord-logo--v2
  • kisspng-github-pages-logo-repository-fork-github-logo-1-magentys-5b69de71b51265

Dragon Eye Intelligence LLC

bottom of page