Well Steven, your code would enter into an infinite loop.
It would trace the first "i", then the if will be true, and it will loop
till j is false (reaches zero).
Then while(i--) runs again, the if will be true again, and the while(j--)
will run forever, since j will start at -1, which is true.
(Actually not forever, since eventually an int will overflow and become
false again...)
On Mon, Apr 7, 2008 at 2:05 PM, Steven Sacks <[EMAIL PROTECTED]>
wrote:
> Your if statement is pointless because defaultSection is ALWAYS less than
> maxSection because you're not altering either of those variables.
>
> That being said, this is much faster:
>
> var defaultSection:int = 3;
> var maxSection:int = 6;
> var i:int = maxSection + 1;
> var j:int = defaultSection;
>
> while (i--)
> {
> trace( " - " + i );
> if (defaultSection < maxSection)
> {
> while (j--)
> {
> trace( " - " + j);
> }
> }
> }
>
> Helmut Granda wrote:
>
> > oh yeah.... forgot the loop:
> >
> > var defaultSection : Number = 3;
> > var maxSection : Number = 6;
> >
> > for (var i : Number = defaultSection ; i < maxSection + 1 ; i ++ )
> >
> > {
> >
> > trace ( " - " + i ) ;
> >
> > }
> >
> >
> > if (defaultSection < maxSection)
> >
> > {
> >
> > for (var i : Number = 1 ; i < defaultSection ; i ++ )
> >
> > {
> >
> > trace ( " - " + i ) ;
> >
> > }
> >
> > }
> >
> >
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders