0 2 4 6 8 10NUM started out at 0, and the
DO WHILE
statement let the loop body execute,
so "0" was printed.
Then NUM was increased by 2 in the LET
statement,
so the next time
the loop body executed, "2" was printed.
NUM
kept increasing by two until it was
too big for the DO WHILE
statement.
Let's practice with another loop. Remember to look at these three things to figure out what the loop does:
LET
statement.DO WHILE
statement.LET
statement
in the loop body.' Loop with increase amount of 3 ' LET NUM = 3 'First Value DO WHILE NUM <= 15 'next two statements execute if NUM is less than or equal to 15 PRINT NUM LET NUM = NUM + 3 'increase NUM by two LOOP END
What will this new program print on the monitor screen? Be careful with the first two numbers.