+ 1

while loop

I believe there is an error in one of the while loop questions. The question has us fill in the blanks for the following code -- $i = 1; while($i <= __) { echo $i; $i__; } I tested this out and the correct answer is 16 in the condition part, then of course ++. To get a 'correct' response to the question, the user needs to input 15, which should not be correct. I am not sure if it has been asked about or answered already, but am I correct that this is false?

19th Aug 2018, 6:17 AM
Jason Consiglio
2 Answers
+ 2
no, given you're printing out numbers from 1 to 15, the answer is 15. because it says "while($i <= _)" and not "while ($i < _)"
19th Aug 2018, 6:27 AM
hinanawi
hinanawi - avatar
+ 1
ahhh i see now.. it was late when i was looking at it.. fatigue throws me off.
19th Aug 2018, 6:17 PM
Jason Consiglio