Computer Studies
An unconditional GOTO sets up an infinite loop. Explain with an example.
Answer
A GOTO statement directs the control to transfer the desired label to set up a loop. An unconditional transfer of control sets up an infinite loop, from where there is no exit.
Example:
CLS
A = 1
START:
PRINT A
A = A + 1
GOTO START:
END
Here, after the value of A is incremented, the control transfers to the label unconditionally. So, this GOTO sets up an infinite loop.
Related Questions
What is a counter? Explain with reference to a program.
What are the different types of conditional statements used in QBASIC programming? Explain.
Define accumulator. Is it necessary to initialise an accumulator?
What are the different types of relational operators used along with a conditional statement in a program?