Page 169 - Open Soource Technologies 304.indd
P. 169

Unit 6: VB Control Structure



               6.7 Summary

                  • Loop is one of the most important structure in visual basic, as it repeats a sequence of
                    statement either as long as until a certain condition is true.

                  • Do-while loops repeat the sequence of statement as long as or until certain condition is true.
                  • Next loops are easy to reaed and write and also have features that make them ideal for
                    certain common tasks.

               6.8 Keywords

               Do loops: It repeats a sequence of statements either as long as or until a certain condition is true
               Else If clauses: An extension of the If block allows for more than two possible alternatives with
               the inclusion of ElseIf clause
               If block: If block allows a program to decide on course of action based on a course of action based
               on whether certain conditions are true or false.
               Loop:  A loop, one of the most important structures in Visual Basic, is used to repeat a sequence
               of statements a number of times.
               User-Defined Type (UDT):  In previous versions of Visual Basic a Structure  was called a user-
               defined type (UDT).
               While Wend statement:  The While Wend statement repeats a block of code while a condition is
               true. The condition is always evaluated before entering the loop. If it is not fulfilled, the loop
               is never executed.



                              Write a program using if-else statement.




               6.9 Self Assessment Questions
                  1. In general, a  Structure  type is defined by:

                     (a) Structure  block of the form  (b) Structure block of pixel
                     (c) Structure block of the image (d) None of the above.
                  2. Visual Basic a  Structure  was called as a user-defined type (UDT).
                     (a) True                     (b) False
                  3. Subvariables of the Structure  type is called a………………
                     (a) sub member               (b) group
                     (c) member                   (d) none
                  4. An ……….. allows a program to decide on a course of action based on whether certain
                    conditions are true or false.
                     (a) If-else                  (b) If block
                     (c) For—next loop            (d) Do while loops




                                      LOVELY PROFESSIONAL UNIVERSITY                        163
   164   165   166   167   168   169   170   171   172   173   174