> Hey there Dick,
>
> On Tue, 17 Aug 2004 15:14:26 -0700, Dick Applebaum
> <[EMAIL PROTECTED]> wrote:
> > I think that variables referenced within the loop conditional are
> > considered local
>
> I thought so too, but then why does the cfscript block act differently
> then the tagged block ... or am I missing something
>
> > I've seen this is some languages -- Fortran, Forth, _javascript_?
> Java?
> >
> > the inner just opens a new local scope
>
> um... well this:
> <script language="_javascript_" type="text/_javascript_">
> for(i=0;i<=10;i++)
> {
> for(i=0;i<=10;i++)
> {
> document.write(i + "<br>");
> }
> }
> </script>
>
> acts like the cfscript looping to 10 only as I would expect - not to
> 10 10 times
>
Well... I'm just full of crap!
Dick
> > If you want to get to the outer variable:
> >
> > 1) Use a different variable
> > 2) set another variable, say outeri = i; before executing an inner
> >
> > I think it is a feature, not a bug.
>
> I am going to rewrite it as I have never seen variable reuse on inner
> loops, and I don't think it works in most languages - but as you
> pointed out I guess it works that way on Fortran. But if it is indeed
> a feature, how do you get to the outer loop variable - if its scoped
> what is the scope name?
>
> > If that is what is supposed to happen, then it might make sense to
> use
> > the same variable (for clarity) within a deeply nested set of
> > conditionals -- instead of i,j,k,l,m....
>
> yeah, thats how I was taught (I didn't write the fragment in question
> - nor would I ever do that even if it is legal cfml)
>
> > One look at the code would tell you that the redundant variable name
> > applies to this level only -- not an inner or outer level.
>
> But why only in the tag syntax? ... oh well I guess its unanswerable
> :-/
>
> > That's my SWAG!
>
> Thanks for the input Dick
>
> Cheers
>
> --
> ~The cfml plug-in for eclipse~
> http://cfeclipse.tigris.org
> ~open source xslt IDE~
> http://treebeard.sourceforge.net
> ~open source XML database~
> http://ashpool.sourceforge.net
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

