The open loop specifies a more powerful loop construction that will continue to iterate until a condition is met to terminate this. The condition is held in the WHILE clause. The REPEAT statement takes the control back to the first line after the LOOP statement.
Example
LOOP
CRT "Input 2 Numbers"
INPUT Y.NUM1
INPUT Y.NUM2
WHILE Y.NUM1:Y.NUM2 ;*//A condition is being checked using the While clause. ‘:’ is the concatenation operator in Infobasic. The While statement specified here checks if Y.NUM1 and Y.NUM2 contain values.
CRT "Total " : Y.NUM1 + Y.NUM2
REPEAT
0 comments:
Post a Comment