Code explanation

Explorer ,
Sep 06, 2020

Copy link to clipboard

Copied

I need explanation cuz I don't get this.
This || is or, and && is and, right?
so why if I use like this
if(PW1 == 0 && PS < 5){
PW2G.display = display.visible;
PW2B.display = display.hidden;}

it triggers on either PW1 or PS it doesn't matter which one.
Shouldn't it need both requirements to trigger?

And if I use with || it needs both requirement and it shouldn't, it would need PW1 or PS right?
it's like && and || changed roles or I'm not getting something here?

TOPICS
How to

Views

27

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Code explanation

Explorer ,
Sep 06, 2020

Copy link to clipboard

Copied

I need explanation cuz I don't get this.
This || is or, and && is and, right?
so why if I use like this
if(PW1 == 0 && PS < 5){
PW2G.display = display.visible;
PW2B.display = display.hidden;}

it triggers on either PW1 or PS it doesn't matter which one.
Shouldn't it need both requirements to trigger?

And if I use with || it needs both requirement and it shouldn't, it would need PW1 or PS right?
it's like && and || changed roles or I'm not getting something here?

TOPICS
How to

Views

28

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 06, 2020 0
try67 LATEST
Most Valuable Participant ,
Sep 06, 2020

Copy link to clipboard

Copied

Yes, that's correct, but what you're describing is impossible. There must be something else at hand here.

Can you post the full code, and/or share the actual file?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 06, 2020 0