How many layer of logic in an IF statement
CelticLord
Posts: 50
when performing an IF statement, how many layers of logic can I use in the same IF.
Example.....
if x==1 or x==3 or x==5 and y==1
action to preform here
else
action to perform here
The above will notwork for me, I have to use the folowing...................
if x==1 and y==1
action
elseif x==3 and y==1
action
elseif x==5 and y==1
action
else
action
Example.....
if x==1 or x==3 or x==5 and y==1
action to preform here
else
action to perform here
The above will notwork for me, I have to use the folowing...................
if x==1 and y==1
action
elseif x==3 and y==1
action
elseif x==5 and y==1
action
else
action
Comments
EDIT: You should also use parentheses. So your if statement should be "if (x==1 or x==3 or x==5) and y==1".
edited the post.
Yes it was the Parentheses that were missing. Thankyou Dave and Tom!
without them it was doing strangeeeee things and I didn't understand why untill now.