Page 74 - ModularV1.1 _c6_flipbook
P. 74
SAMPLE PROGRAMS USING WHILE…END...WHILE
STATEMENT
Program 9: To print the numbers from 1 to 5.
Program 10: To print a table of the number entered by the user.
INFINITE LOOP
A loop that never ends is called infinite loop. We should avoid such conditions while programming.
If a while loop condition does not become false, the loop runs for ever, creating an infinite loop.
Example 1:
number = 1
WHILE (number < 10)
PRINT number
END WHILE
The above program will never end as the value of number is always 1, which is less than 10. So,
the loop will execute infinite times.
Example 2: Tech
WHILE (True)
Funda
PRINT "Loop Never Ends"
END WHILE Once the loop reaches its end, we use the
keyword END WHILE to signal that the while
loop will end. That way the loop does not
continue forever, creating an infinite loop.
72 Modular (Ver. 1.1)-VII

