This site requires JavaScript, please enable it in your browser!
Greenfoot back
gusbus123
gusbus123 wrote ...

2012/6/11

quick question about the || and &&

gusbus123 gusbus123

2012/6/11

#
in an if statement, if i do something like ((x==1 &&(y==1||y==2)) || (x==2 &&(y==1||y==2))) would this read them in the groups they are in by the brackets?
Busch2207 Busch2207

2012/6/11

#
Yes it will. This will return true if x and y are 1 or 2. But you could write it a bit shorter: if((y==1||y==2) && (x==1 || x==2))
gusbus123 gusbus123

2012/6/11

#
oh those were just examples. lol but thx. :)
You need to login to post a reply.