In a WHILE ... WEND loop, if the condition is True, all statements are executed until WEND keyword is encountered. If the condition is false, the loop is exited and the control jumps to very next statement after WEND keyword.
WHILE [statements] WEND
WAP to print the natural numbers from 1 to 10
CLS n = 1 WHILE n <= 10 PRINT n; n = n + 1 WEND END
WAP to print even numbers from 1 to 20
CLS n = 2 WHILE n <= 20 PRINT n; n = n + 2 WEND END
WAP to print the numbers from 20 to 1 in descending order.
CLS n = 20 WHILE n >= 1 PRINT n; n = n - 1 WEND END
WAP to print your name 10 times
CLS n = 1 WHILE n <= 10 PRINT "Your Name" n = n + 1 WEND END
WAP to print the multiplication table of given number.
CLS i = 1 INPUT "Enter any number "; n WHILE i <= 10 PRINT n; "x"; i; "="; i * n i = i + 1 WEND END