- 1

What is the least number of times the body of a while loop can be executed?

While loops

6th Mar 2017, 11:12 AM
johnson
johnson - avatar
4 Respostas
+ 2
0
6th Mar 2017, 11:40 AM
Meharban Singh
Meharban Singh - avatar
+ 1
@Meharban the point was to get them to figure it out so they udnerstood why the answer was 0 and that's why. At the top of the loop the condition gets evaluated and if the condition is false it skips the body of code.
6th Mar 2017, 11:43 AM
Alexandre Sabourin
Alexandre Sabourin - avatar
0
Well a while loop works by evaluating the condition within the parantheses at the top and then enters the body of code if it evaluates to true. So if the condition is false, does it enter the loop?
6th Mar 2017, 11:14 AM
Alexandre Sabourin
Alexandre Sabourin - avatar
0
No @Alexandre
6th Mar 2017, 11:41 AM
Meharban Singh
Meharban Singh - avatar