if(click==0 && !0)

Mutikasa

Power Member
Joined
May 23, 2011
Messages
589
Reaction score
216
can you explain me this code?
To me it means "if click is zero and zero not".
I don't understand
 
In some languages you can set 0 as a variable.
Thats ehy the !0 part is

For example in python it's common to set 1 to True and 0 to False

Anyways the code should be "if (click === 0)" to avoid issues like this
 
It means..

Check if variable "click" is 0 and 0 equals false ?!

== means equals
&& means "and"
! means "not"

But as bot solutions said.. some programming languages allow stupid shit like that.
Also what he suggested means:

Check if variable" click is identical to 0.

Equal and identical are different things..

For example in PHP "0" is equal to 0, but "0" is not identical to 0, because in PHP (technically in javascript too?) stuff in quotes or apostrophes has "string" type.. even if it's a number.

So:

"0" = string
0 = integer

So:

"0" == 0 is true
"0" === 0 is false

It's false because when it's comparing them then both need to be string or integer AND zero.
 
Back
Top