Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-26-2006, 04:23 PM   #1
MapAnalysis
Registered User
 
Join Date: Oct 2006
Posts: 7
Default for....loop Bug

I tried this:

var i:int;
for (i = 0; i < 5; i++) {

Alert.show(i.toString());


}

And received 4,3,2,1

This is standard stuff guys:

Workaround to get what I wanted ie 1,2,3,4

var i:int;
for (i = 5; i > 0; i--) {

Alert.show(i.toString());


}
MapAnalysis is offline   Reply With Quote
Old 10-26-2006, 05:53 PM   #2
Tink
Addict
 
Tink's Avatar
 
Join Date: Nov 2001
Location: London
Posts: 2,128
Default

huh?

Code:
for ( var i:int = 0; i < 5; i++)
{
trace( i );
}
will output 0, 1, 2, 3, 4

Code:
for ( var i:int = 5; i > 0; i00)
{
trace( i );
}
will output 5, 4, 3, 2, 1

Alerts open on top of each other. Theres no bug here.
Tink is offline   Reply With Quote
Old 10-31-2006, 05:33 PM   #3
newblack
dondeEstanMisPantalones?
 
newblack's Avatar
 
Join Date: Nov 2005
Location: New York Proper
Posts: 1,355
Send a message via AIM to newblack
Default

lolz
__________________
i am gibreel farishta
general relativity
jellytanks alpha redux
newblack is offline   Reply With Quote
Old 11-02-2006, 06:44 AM   #4
jsebrech
Joeri Sebrechts
 
Join Date: Apr 2005
Location: Antwerp, Belgium
Posts: 1,465
Default

Whenever you suspect the development tool has a bug, assume you're wrong and it doesn't. It is extremely rare that it happens, and it's almost never in basic syntax. (Last time I ran across a dev tool bug was in the memory allocation routines of an older version of Delphi, which were sensitive to fragmentation in the right conditions.)
jsebrech is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:28 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.