🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6704

Re: Use of scope

#6704
From: Bill Poser
Date: Sun, 11 Feb 1990 04:26
12 lines
1286 bytes
In article <760@enea.se> sommar@enea.se (Erland Sommarskog) writes:
>Ada is really nice here. You declare the index variable with the FOR
>loop, so that you can only refer to it within the loop.

This is true of some other languages as well, but I'm not sure if it is
a feature. When writing C I find that it is often very convenient to
have access to the loop index. Sometimes testing it is an easy way to
detect an unusual loop exit that requires special handling, and sometimes
I want to process part of an array in the first loop, exit at a point
that may be data dependent, then resume processing in a second loop
that needs to know where to start. (And often a for loop is more convenient
than a while loop.)
Technical Details
Message-ID: <12200@csli.Stanford.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!lll-winken!decwrl!shelby!csli!poser
References: <PCG.90Feb5163252@rupert.cs.aber.ac.uk> <14226@lambda.UUCP> <760@enea.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!lll-winken!decwrl!shelby!csli!poser
From: poser@csli.Stanford.EDU (Bill Poser)
Newsgroups: comp.lang.misc
Subject: Re: Use of scope
Summary: Narrow scope of for loop index is not clearly a feature.
Message-ID: <12200@csli.Stanford.EDU>
Date: 11 Feb 90 04:26:19 GMT
References: <PCG.90Feb5163252@rupert.cs.aber.ac.uk> <14226@lambda.UUCP> <760@enea.se>
Sender: poser@csli.Stanford.EDU (Bill Poser)
Organization: Center for the Study of Language and Information, Stanford U.
Lines: 12