1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

if(click==0 && !0)

Discussion in 'HTML & JavaScript' started by Mutikasa, Sep 8, 2015.

  1. Mutikasa

    Mutikasa Power Member

    Joined:
    May 23, 2011
    Messages:
    581
    Likes Received:
    207
    can you explain me this code?
    To me it means "if click is zero and zero not".
    I don't understand
     
  2. Bot Solutions

    Bot Solutions Regular Member

    Joined:
    Aug 19, 2014
    Messages:
    219
    Likes Received:
    362
    Occupation:
    Bot maker
    Location:
    Hungary
    Home Page:
    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
     
    • Thanks Thanks x 2
  3. Diplomat

    Diplomat Jr. VIP Jr. VIP

    Joined:
    Oct 25, 2011
    Messages:
    949
    Likes Received:
    441
    Home Page:
    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.
     
    • Thanks Thanks x 2
  4. Mutikasa

    Mutikasa Power Member

    Joined:
    May 23, 2011
    Messages:
    581
    Likes Received:
    207
    well, this one makes sense