Thread View: comp.lang.oberon
3 messages
3 total messages
Started by Eric W. Nikitin
Fri, 12 Apr 1996 06:09
Oberon's FOR
Author: Eric W. Nikitin
Date: Fri, 12 Apr 1996 06:09
Date: Fri, 12 Apr 1996 06:09
11 lines
825 bytes
825 bytes
Questions about the FOR statement in Oberon(-2): Is the value of the counter variable undefined upon exiting the loop - as it is in Pascal and Modula-2? Also, I've found that in both Oberon/F and Oberon V4 for Windows, I could change the counter variable within the FOR loop. I thought this was illegal in Modula-2 - and that Oberon(-2)'s FOR loop was the same as Modula-2's. Is it legal (as per the language definition) to change the counter within the loop?
Re: Oberon's FOR
Author: Stephan Gehring
Date: Mon, 15 Apr 1996 06:22
Date: Mon, 15 Apr 1996 06:22
31 lines
1607 bytes
1607 bytes
In article <4kks25$hru@wariat.wariat.org>, Eric W. Nikitin <enikitin@junior.wariat.org> wrote: >Questions about the FOR statement in Oberon(-2): > >Is the value of the counter variable undefined upon exiting the loop - >as it is in Pascal and Modula-2? No >Also, I've found that in both Oberon/F and Oberon V4 for Windows, I could >change the counter variable within the FOR loop. I thought this was illegal >in Modula-2 - and that Oberon(-2)'s FOR loop was the same as Modula-2's. > >Is it legal (as per the language definition) to change the counter within >the loop? Yes. The Oberon-2 report defines the semantics of the FOR statment as a WHILE statement (cf. Oberon-2 report). Since the semantics is that of a WHILE statement a) the counter variable may be changed within the loop body b) the value of the counter variable is defined after exiting the loop -- Stephan Gehring ------------------------------------------------------------------------------ Stephan Gehring Email: gehring@inf.ethz.ch Institute for Computer Systems Phone: +41 1 632 73 15 ETH-Zentrum FAX: +41 1 632 13 07 CH-8092 Zurich, Switzerland
Re: Oberon's FOR
Author: Robert Lichtenberger
Date: Mon, 15 Apr 1996 06:41
Date: Mon, 15 Apr 1996 06:41
18 lines
1120 bytes
1120 bytes
Eric W. Nikitin (enikitin@junior.wariat.org) wrote: : Questions about the FOR statement in Oberon(-2): : : Is the value of the counter variable undefined upon exiting the loop - : as it is in Pascal and Modula-2? : : Also, I've found that in both Oberon/F and Oberon V4 for Windows, I could : change the counter variable within the FOR loop. I thought this was illegal : in Modula-2 - and that Oberon(-2)'s FOR loop was the same as Modula-2's. : : Is it legal (as per the language definition) to change the counter within : the loop? Yes it is legal, but it's _very bad_ style ;-) -- Robert Lichtenberger tanis@sport2.uibk.ac.at k3086e1@cxmeta.edvz.uni-linz.ac.at http://sport2.uibk.ac.at/~tanis
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads