KnowledgeBoat Logo
|

Computer Studies

Explain the following with an example:
(a) Continuous loop
(b) Step loop

QBASIC: For-Next Statements

14 Likes

Answer

(a) Continuous loop: If the increment of the loop variable is by one, then it is known as a continuous loop.

Example:

CLS
FOR I = 1 TO 10
PRINT "CONTINUOUS LOOP"
NEXT I
END

(b) Step loop: If the increment of the loop variable is defined by STEP and the value is other than one, then it is known as a step loop.

Example:

CLS
FOR I = 1 TO 10 STEP 2
PRINT "CONTINUOUS LOOP"
NEXT I
END

Answered By

5 Likes


Related Questions