🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.oberon
Article #1331

Re: Oberon's FOR

#1331
From: Stephan Gehring
Date: Mon, 15 Apr 1996 06:22
31 lines
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
Technical Details
Message-ID: <4kspuk$ohd@lillian.inf.ethz.ch>
Path: arc1-ca.pugleaf.net!elna.ethz.ch!not-for-mail
References: <4kks25$hru@wariat.wariat.org>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!elna.ethz.ch!not-for-mail
From: gehring@inf.ethz.ch (Stephan Gehring)
Newsgroups: comp.lang.oberon
Subject: Re: Oberon's FOR
Date: 15 Apr 1996 08:22:12 +0200
Organization: Dept. Informatik, Swiss Federal Institute of Technology
Message-ID: <4kspuk$ohd@lillian.inf.ethz.ch>
References: <4kks25$hru@wariat.wariat.org>
NNTP-Posting-Host: lillian-ics.inf.ethz.ch