Looping statements allow a set of instructions to be performed repeatedly until a certain condition is fulfilled. QBASIC provides three types of looping statements: FOR NEXT loop, WHILE-WEND loop and DO UNTIL loop. FOR...NEXT command is used to execute a part of a program a certain number of times. In nested FOR-NEXT loop, one FOR-NEXT statement is within another FOR-NEXT statement. WHILE ...WEND loop is executed until the condition is true. If the condition becomes false, execution passes to the statement after WEND.
DO LOOP statements are sets of instructions which are repeated while or until the condition is satisfied. In DO WHILE...LOOP, execution continues until the given condition is true. In DO UNTIL...LOOP, execution continues until the condition is false.