Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.


10.5.4 LOOP block

A LOOP block is a multi-line statement. It's the general form of loops like the WHILE loop, and it builds a loop with no check. So, this kind of loop would normally never end. However, as we now know, you can terminate a LOOP block using the JUMP statement. As an example, the following two code fragments are equivalent:

  x:=0
  LOOP
    IF x<100
      WriteF('x is \d\n', x++)
    ELSE
      JUMP end
    ENDIF
  ENDLOOP
end:
  WriteF('Finished\n')

  x:=0
  WHILE x<100
    WriteF('x is \d\n', x++)
  ENDWHILE
  WriteF('Finished\n')


Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.