Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 109 - 2505_CoreGPT(Podar)_Flipbook_C7
P. 109

    NESTING OF LOOPS

                     Nesting loops means placing one loop inside another. In this case, an outer loop runs first and
                     for each iteration of the outer loop, the inner loop runs completely. The basic syntax of the
                     nesting of loops is as follows:

                     FOR outer_variable = start_value TO end_value

                         FOR inner_variable = start_value TO end_value

                             ' Inner loop code

                         NEXT inner_variable

                     NEXT outer_variable
                     Sample Programs using Nested Loop

                     Program 1: To print 3 rows of numbers using nested loop.

                     Program 2: To print multiplication tables from 2 to 5 using nested loop.

                                                                         Looping Control Statements in BASIC-256        107

| 104 105 106 107 108 109 110 111 112 113 114 |