At this point the monitor looks like:
Type a number ? 100 6% of the number is 6
But we are not done, yet.
Here is the example program, again:
' Example of a loop DO PRINT "Type a number" INPUT NUMBER PRINT "6% of the number is", NUMBER * 0.06 LOOP END
The statements between DO
and LOOP
have each been executed once.
The variable NUMBER
has the value 100 in it:
100 |
Now the statements inside the loop start again with the first
statement after DO
:
PRINT
statement
prints "Type a number".INPUT
statement gets
a number to put in the
variable NUMBER
.
PRINT
statement prints
"6% of the number is"
and then computes and prints 50 * 0.06.LOOP
statement marks the end of the loop.
At this point,
variable NUMBER
now has the new value of 50 in it:
50 |
The monitor now shows:
Type a number ? 100 6% of the number is 6 Type a number ? 50 6% of the number is 3
What do you suppose happens next. Have the user enter the number 200.