Article View: comp.sys.atari.st
Article #39218Modula-2 and LONGCARD looping
From: G. Brandon Brooks
Date: Tue, 06 Jun 1989 01:23
Date: Tue, 06 Jun 1989 01:23
27 lines
1090 bytes
1090 bytes
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!
Technical Details
Message-ID:
<6306@cs.Buffalo.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sunybcs!uggbrandShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sunybcs!uggbrand From: uggbrand@cs.Buffalo.EDU (G. Brandon Brooks) Newsgroups: comp.sys.atari.st Subject: Modula-2 and LONGCARD looping Message-ID: <6306@cs.Buffalo.EDU> Date: 6 Jun 89 01:23:21 GMT Sender: nobody@cs.Buffalo.EDU Reply-To: uggbrand@cs.Buffalo.EDU (G. Brandon Brooks) Organization: SUNY/Buffalo Computer Science Lines: 27