Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-17-2012, 04:00 PM   #1
Registered User
Join Date: Dec 2009
Posts: 30
Red face what does this mean

I'm not too familiar with AS2 code as I am with AS3 code. I found some AS2 code and was curious as to what this means.

var a = 0;
var b = 3;
for(var a= -b;a<=0;++a)
-b??? what the heck is that. Honestly if I had to guess I'd say -b = -3. I'm I right?

KunoNoOni is offline   Reply With Quote
Old 04-17-2012, 07:40 PM   #2
Toys in the Attic...
Noct's Avatar
Join Date: Oct 2006
Location: NY
Posts: 3,022

Yeah, it's just reversing the polarity of the second variable. Same as multiplying it by -1.

It's not the most elegant way to write this loop either, but it'll execute... For one thing, why you would declare those two variables outside the loop, just to turn around and redeclare them again...

Also, heh, just to bust your hump... This wouldn't be any different in As3 apart from the fact that it would warn you of the double variable declare.
Noct is offline   Reply With Quote

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 Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 11:39 PM.

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.