Little problem with "If --- EndIf"
Monkey Forums/Monkey Programming/Little problem with "If --- EndIf"
| ||
Hello all. I was wondering if it was possible to have in the If statement more than one comparison. Example: If x <> "up" And "down" And "left" And "right" gotosleep() EndIf Basically what i want to do is to execute the gotosleep() function if x is not "up" ,"down" ,"left" ,"right" without having to do 4 different if blocks... Hope it make sense. Is it even possible? |
| ||
If x <> "up" And x <> "down" And x <> "left" And x <> "right" gotosleep() EndIf or (probably not what you want) If Not "up|down|left|right".Contains(x) gotosleep() EndIf |
| ||
in such cases I often use...If "up,down,left,right".Contains(x)=FALSE .... |
| ||
Thank you very much, the version with "contains" did the trick. I wasn't even aware of it's existence... |