Page 59 - 1
P. 59
outer loop defined for each inner loop. Firstly, the innermost loop will be executed.
Example
REM Program to print tables from 15 to 12
FOR A=15 TO 12 STEP -1
FOR Z=1 TO 10
PRINT “A*”, “Z”, “=”, A*Z
NEXT Z
PRINT
NEXT A
END
This program will display the output as the table of 15 to 12.
While...Wend Statement
WHILE...WEND statement is used at times when we need to run a program repeatedly when
the given condition remains true.
Syntax
WHILE condition
{
Statement(s)
}
WEND
Example
A = 10
WHILE A < 15
PRINT A
A=A+1
WEND
END
In this example first the value will be taken as 10 and the condition will be checked. If the
condition is true then the value will be displayed. Then 1 will be added to the value and
again the condition will be checked. If the value is true then the number will be displayed.
This will go on and on till the condition is true. When the condition is false then the
program will go to the statement after WEND.
59