Loops are accomplished by various programming structures that have a beginning, body and end. The beginning generally tests the condition that keeps the loop going. The body comprises the repeating statements, and the end is a GOTO that points back to the beginning. In assembly language, the programmer writes the GOTO, as in the following example that counts to 10.
MOVE "0" TO COUNTER LOOP ADD "1" TO COUNTER COMPARE COUNTER TO "10" GOTO LOOP IF UNEQUAL STOPIn high-level languages, the GOTO is generated by the interpreter or compiler; for example, the same routine as above using a WHILE loop.
COUNTER = 0 DO WHILE COUNTER <> 10 COUNTER = COUNTER + 1 ENDDO STOPFor a more detailed look at a loop, look at the end of the C definition. The main event loop of the DOS version of this database is presented.
Computer Desktop Encyclopedia THIS DEFINITION IS FOR PERSONAL USE ONLY. All other reproduction is strictly prohibited without permission from the publisher.Copyright © 1981-2010 by Computer Language Company Inc. All rights reserved.
Learn more about loop