Ask coding questions

← Back to all posts
If Else
h
DonoldJTrump (9)

I have an

if (Cookies == 0 && Cookies == 1) {
      plurl = 'cookie';
      console.log(plurl)
    } else {
      plurl = 'cookies';
      console.log(plurl)
    }
}

For some reason, my variable will not change when the conditions are met. I have it outputing the results to the console (debugging), but it dose not seem to be working. Any ideas?

@Coder100
Answered by Coder100 (18187) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (18187)

well

did you see this bogus statement

cookies can't ever be 0 and 1 at the same time, did you mean Cookies == 1?

DonoldJTrump (9)

@Coder100 THAT makes scene. I used and instead of or. I am an idiot.

DonoldJTrump (9)

@Coder100 also sorry for the ping

Coder100 (18187)

lol np

btw wouldn't you say 0 cookies and not 0 cookie @DonoldJTrump

DonoldJTrump (9)

@Coder100 technically you would never see Your cookies are 0, soooooooooooo...