Path: utzoo!attcan!uunet!husc6!bu-cs!buengc!art From: art@buengc.BU.EDU (A. R. Thompson) Newsgroups: comp.lang.pascal Subject: Re: Control variables in FOR loops Message-ID: <1770@buengc.BU.EDU> Date: 22 Dec 88 18:57:39 GMT References: <1439@csuna.UUCP> <169@m2xenix.UUCP> <1712@buengc.BU.EDU> <170@m2xenix.UUCP> Reply-To: art@buengc.bu.edu (A. R. Thompson) Followup-To: comp.lang.pascal Organization: Boston Univ. Col. of Eng. Lines: 19 In article <170@m2xenix.UUCP> randy@m2xenix.UUCP (Randy Bush) writes: >In article <1712@buengc.BU.EDU> art@buengc.bu.edu (A. R. Thompson) writes: >>In article <169@m2xenix.UUCP> randy@m2xenix.UUCP (Randy Bush) writes: >>>The interesting, and unexpected, restriction is that it may not be threatened >>>by use within an enclosed procedure/function. The following is not legal: >> >>If you want to make assigning references to the control variable in a looping >>statement, you should use either a while statement or a repeat statement. >>That's what they are for (so to speak). > >Please peruse the example again. There was no assignment to the control >variable during the dynamic execution of the FOR statement. In fact, the >procedure containing the threat is never called, nor is there any code in >the FOR's statement sequence. Yes, but there was more to the question than just the example. The poster raised a question wrt assignments to the control variable within the body of the for statement. Many people I have encountered want to do this. It's not just wrong, it's downright dangerous.