Page 60 - 1
P. 60

Do Until Statement

DO UNTIL statement is used when a loop has to be executed repeatedly while a given condition

remains false, or becomes true.

Syntax                                           Scratch your Brains
DO UNTIL condition
{                                         If you give a value to a letter say
Statement                                A and you want the output as the
}                                multiplication table of the value input for letter
LOOP                                     A less than 100, what will you do?
Example                               Which looping statement will you use?
Z = 10
                                                 Discuss in the class.

DO UNTIL Z > 15

PRINT Z

Z=Z+1

LOOP

END

In this example, the value of Z will be taken and then the condition will be checked. If the

condition of Z will be false, then the value of Z will be displayed. This goes on and on till the

condition is true. If the condition is true then the control will shift to the statement after LOOP.

                    Open QBASIC and practice all the examples of looping statements

                    that you have learnt in this chapter. Also find out some programs

      I am          from the internet and practice them ad show the result in the class.
      Gizo.

    Backup Time

           FOR...NEXT Loop statement reduces the length of the program.
           FOR...NEXT WITH STEP statement is used to increase or decrease the value of the control variable
           by our own choice.
           NESTED-FOR...NEXT statement is used as nested loop for FOR...NEXT statement.
           WHILE...WEND statement is used at times when we need to run a program repeatedly when the
           given condition remains true.
           DO UNTIL statement is used when a loop has to be executed repeatedly while a given condition
           remains false, or becomes true.

60
   55   56   57   58   59   60   61   62   63   64   65