NO, because COUNT
has a 5 stored in it, and:
COUNT < 5
^
|
+----- holds a 5
is FALSE because 5 is NOT less than 5.
Here is the modified program:
' Loop with LESS THAN ending test ' LET COUNT = 0 'Statement 1 ' DO WHILE COUNT < 5 'Statement 2 PRINT COUNT 'Statement 3 LET COUNT = COUNT + 1 'Statement 4 LOOP END
When it runs it will print out:
0 1 2 3 4
COUNT starts out at 0, and since 0<5 is true, the loop body
is executed, and "0" is printed.
The loop body is executed 4 more times until finally COUNT
is
changed to 5 in Statement 4.
Since 5 < 5 is FALSE, the loop body is not executed, and "5" is not printed out.
It takes practice to get these things right. Here is the same program, but now with yet another change:
' Loop with LESS THAN ending test ' LET COUNT = 2 'Statement 1 ' DO WHILE COUNT < 5 'Statement 2 PRINT COUNT 'Statement 3 LET COUNT = COUNT + 1 'Statement 4 LOOP END
Now what will the program print to the screen?