Forum Topic: = and ==

(247 views • 13 replies)

This topic is 1 page long.

<< < > >>
None

Damian

Reply To Post Reply & Quote

Posted at: 7/31/08 05:33 PM

Damian LIGHT LEVEL 13

Sign-Up: 03/29/06

Posts: 1,674

Can someone remind me what the difference between these two are, and when to use which.


Kissing

zrb

Reply To Post Reply & Quote

Posted at: 7/31/08 05:35 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,549

At 7/31/08 05:33 PM, Damian wrote: Can someone remind me what the difference between these two are, and when to use which.

The "=" assigns a value to something.
Ex: var poop = 1;
The "==" checks if 2 values are the same.
Ex: if (poo==1) {
trace("Poo is 1");
}

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

K-Guare

Reply To Post Reply & Quote

Posted at: 7/31/08 05:41 PM

K-Guare FAB LEVEL 17

Sign-Up: 05/23/08

Posts: 2,429

Zrb is correct one again :]

You use = for assignment,
like in his example.
You use == during conditions.
Here's a tutorial on loops + conditions.

dr. seuss
"unless someone like you cares a whole awful lot, nothing is going to get better. it's not."

BBS Signature

None

zrb

Reply To Post Reply & Quote

Posted at: 7/31/08 05:41 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,549

At 7/31/08 05:41 PM, K-Guare wrote: Here's a tutorial on loops + conditions.

This is the second time you link to that tutorial ;)

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

Damian

Reply To Post Reply & Quote

Posted at: 7/31/08 05:42 PM

Damian LIGHT LEVEL 13

Sign-Up: 03/29/06

Posts: 1,674

Thanks.


None

K-Guare

Reply To Post Reply & Quote

Posted at: 7/31/08 05:44 PM

K-Guare FAB LEVEL 17

Sign-Up: 05/23/08

Posts: 2,429

At 7/31/08 05:41 PM, zrb wrote: This is the second time you link to that tutorial ;)
zrbCorrect += 1;
kguareCorrect -= 1000;
trace(zrbCorrect);

Output: 9001 :]

Yes, the number is over 9000.

dr. seuss
"unless someone like you cares a whole awful lot, nothing is going to get better. it's not."

BBS Signature

None

zrb

Reply To Post Reply & Quote

Posted at: 7/31/08 05:56 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,549

At 7/31/08 05:44 PM, K-Guare wrote: zrbCorrect += 1;
zrbCorrect++; //reduces lag :P
kguareCorrect -= 1000;
trace(zrbCorrect);
Output: 9001 :]
Yes, the number is over 9000.

What over 9000 ?!?!?

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

K-Guare

Reply To Post Reply & Quote

Posted at: 7/31/08 06:04 PM

K-Guare FAB LEVEL 17

Sign-Up: 05/23/08

Posts: 2,429

At 7/31/08 05:56 PM, zrb wrote: zrbCorrect++; //reduces lag :P

Zrb, that's probably the first time
i've ever seen you use

The code tags.

My little boy's growing up :]

And fine, use your cute little operator abbreviations, Real men don't use them.

dr. seuss
"unless someone like you cares a whole awful lot, nothing is going to get better. it's not."

BBS Signature

None

Ismael92

Reply To Post Reply & Quote

Posted at: 7/31/08 06:11 PM

Ismael92 EVIL LEVEL 24

Sign-Up: 07/27/07

Posts: 2,715

At 7/31/08 05:56 PM, zrb wrote: zrbCorrect++; //reduces lag :P

Does it really reduce the lag? I didn't know that...


None

zrb

Reply To Post Reply & Quote

Posted at: 7/31/08 06:12 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,549

At 7/31/08 06:11 PM, Ismael92 wrote: Does it really reduce the lag? I didn't know that...

I've heard that it does :p

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

K-Guare

Reply To Post Reply & Quote

Posted at: 7/31/08 06:14 PM

K-Guare FAB LEVEL 17

Sign-Up: 05/23/08

Posts: 2,429

At 7/31/08 06:12 PM, zrb wrote: I've heard that it does :p

If it does, i learned something today.
But even if that were true, i'm sure
it wouldn't increase the lag by THAT much.

dr. seuss
"unless someone like you cares a whole awful lot, nothing is going to get better. it's not."

BBS Signature

None

zrb

Reply To Post Reply & Quote

Posted at: 7/31/08 06:16 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,549

At 7/31/08 06:14 PM, K-Guare wrote: it wouldn't increase the lag by THAT much.

Doi :P

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

Vengeance

Reply To Post Reply & Quote

Posted at: 7/31/08 06:22 PM

Vengeance EVIL LEVEL 28

Sign-Up: 03/18/05

Posts: 5,033

At 7/31/08 06:14 PM, K-Guare wrote: If it does, i learned something today.

It does, but the difference is so minoscule that its barely noticable unless you're doing around 100,000+ interation.
We're talking, for a 100,000 loop of i++, 288 miliseconds to process, for i+=1 300 miliseconds to process

========|| WWWWWWWW>[-[Blog] - [Audio] - [Userpage] - [Flash] - [Last.fm]-]<WWWWWWWW ||========

BBS Signature

None

K-Guare

Reply To Post Reply & Quote

Posted at: 7/31/08 06:25 PM

K-Guare FAB LEVEL 17

Sign-Up: 05/23/08

Posts: 2,429

At 7/31/08 06:22 PM, Vengeance wrote: It does, but the difference is so minoscule that its barely noticable unless you're doing around 100,000+ interation.
We're talking, for a 100,000 loop of i++, 288 miliseconds to process, for i+=1 300 miliseconds to process

Dear god...

BIG difference. :]

dr. seuss
"unless someone like you cares a whole awful lot, nothing is going to get better. it's not."

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 11:27 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!