It seems to me, that Dacyn’s code executes [stuff] at least once for any n. But iff n <= 0, original while loop does not execute its body. Dacyn’s code looks like a do-while loop.
[stuff]
n
n <= 0
while
do-while
Oh right. For loops check the condition before entering the body, just like while loops and unlike do-while loops. Thanks.
It seems to me, that Dacyn’s code executes
[stuff]
at least once for anyn
. But iffn <= 0
, originalwhile
loop does not execute its body. Dacyn’s code looks like ado-while
loop.Oh right. For loops check the condition before entering the body, just like while loops and unlike do-while loops. Thanks.