[Gambas-user] R: Unending cycle "For...Next" with variable As Byte

RICHARD WALKER richard.j.walker at ...247...
Sun Sep 30 23:24:36 CEST 2012


Sinclair BASIC on the QL used to have a FOR loop epilogue which could
be used to handle this sort of thing. A simple FOR loop was

FOR index = start TO stop
      do some stuff
END FOR index

The NEXT control could be added to create the epilogue so:
FOR byte = 0 TO 254
      PRINT index
NEXT index
      PRINT index
END FOR index

Would print out the values from 0 to 255. If the loop's initial
conditions would not permit execution, control jumps to after the END
FOR marker.

It also allowed :

FOR index = 0 TO 15, 64, 96, 128 to 254, 255

Very useful, and just one of the many features I miss from SuperBASIC.

R




More information about the User mailing list