Computer Science, asked by kamaksha6180, 1 year ago

Compare and contrast the while and for repetition statements

Answers

Answered by LuckyYadav2578
1
● While loop

A while loop is a conditional loop that will repeat the instructions within itself as long as a conditional remains true
body mai contain single statement or multiple statement or an empty statement
the loop iterates while the logical expression evaluates to true when the expression become false, the control passes to the line after the loop body.

● for loop

the for loop is designed to process the item of any sequence, such as list or a string one by one
all the statements in the body executed with assigned value of loop variable
the value of loop variable after the for loop is over is the highest value of the list.
Similar questions