- Home /
how do i use 'And' and 'Or' in UnityScript
hey :)
iv come across a small problem.
how do i use 'and' and 'or'?
as in:
if (this == this and this == this){};
or
if (this == this or this == this){};
i tried used the words 'and' and 'or' and they dont do anything XD
i know that | is used in some languages as 'and' but that didnt work either. && didnt work for 'and' either :S
help please?
Eric is correct, && should work for And. Try posting an example, it may be something elsewhere that's causing it not to work
Answer by Eric5h5 · Mar 19, 2011 at 10:37 AM
| is never used for 'and'. || is used for 'or'. && does work for 'and'. & is used for bitwise 'and' operations; | is used for bitwise 'or' operations.
it will work on the unity player but not in a mobile. you have to use : if(condition1){ if(condition2){ }}
Answer by Meltdown · Mar 19, 2011 at 11:23 AM
if(this == this && that == that){};
if(this == this || that == that){};
Your answer
Follow this Question
Related Questions
What is the difference between these ? 1 Answer
Unity/Javascript Operators 2 Answers
Where did I go wrong (logical operator or tagging) 1 Answer
How is this operator in a variable declaration? 1 Answer
C# Error help ( error CS0023 The `!’ operator cannot be applied to operand of type `string’ ) ??? 1 Answer