top of page
Search
  • Writer's pictureHarshit Sharma

LOOPING STATEMENTS:

The for Loop can be used for just one statement: for(initialization; condition; iteration) statement; or to repeat a block of code: for(initialization; condition; iteration) { statement sequence }

Initialization = assignment statement that sets the initial value of the loop control variable, (counter)

Condition = Boolean expression that determines whether or not the loop will repeat

Iteration = amount by which the loop control variable will change each time the loop is repeated.

WHILE LOOP:

while (condition) statement; //or more than one statement The condition could be any valid Boolean expression. The loop will function only if the condition is true. If false it will move on to the next line of code.

DO WHILE LOOP:

This conditional statement checks the Boolean expression after going at least one time through the loop. The do-while is declared as follows: do { statements; } while(condition);

6 views0 comments

Recent Posts

See All

コメント


Post: Blog2_Post
bottom of page