+ 1
When we use "for" and "while" and "do while"?🤔
4 ответов
+ 2
you use for when, for example checking the length of an array, because the length of the array is finite.
you use while when, you dont know the length and you check whether some conditions are met in order to loop again
do while will perform a least one time before ending.
+ 1
for: when you know the times the loop is going to be active
while: when you don't know for how long your loop will be active
do while: when you need your loop to be active for at least one time
0
Can you explain more?
0
tnx 😘😆