uggbrand@cs.Buffalo.EDU (G. Brandon Brooks) (06/06/89)
This is a response to someone's query over why the following is
not acceptable in Modula-2:
VAR
loop : LONGCARD;
BEGIN
FOR loop := 0 TO xxx DO
...
END;
END;
Very simply stated, Modula-2 does not allow you to use LONGCARDs in loop
statements. Only INTEGERs and CARDINALs. I ran across this before trying
to have a loop statement from 0 to 255 on a BYTE. To bypass this, just use:
VAR
loop : LONGCARD;
BEGIN
LOOP
loop := loop + 1D (* If your compiler needs a 'D' after longcards *)
END;
END;
(use the statement IF loop = xxx THEN EXIT; to get out of the loop)
Hope this helps!