• Log in or sign up for an account here: https://www.sythe.org/login

if (*** or ***) Then...

Cymru

Apprentice

Banned
Joined
Jan 22, 2007
Sythe Gold
0
Messages
693
Location
Down that alley...
Is it possible to add an "or" command so that if one of the options is true, then the command goes through?

Something like this:

String animal = "cat";

if(animal == "cat" or "rabbit")

Thanks.

EDIT: FLIP! I did a search right now and found out how to do it with || and &&...
I can never find out how until I post on sythe...
 
Member of the Month Winner
Sythe's 10th Anniversary
Is it possible to add an "or" command so that if one of the options is true, then the command goes through?

Something like this:

String animal = "cat";

if(animal == "cat" or "rabbit")

Thanks.

EDIT: FLIP! I did a search right now and found out how to do it with || and &&...
I can never find out how until I post on sythe...
You would use the 'or' operator. C languages don't use keywords for instances like this, they use operators.

The or operator is simply
Code:
||

in example,
Code:
if(animal=="cat" || animal=="rabbit") DoShit();

A list of operators for C# can be found on MSDN's website: http://msdn.microsoft.com/en-us/library/6a71f45d(vs.71).aspx
 
Runescape Gamblingrunescape gambling
Back
Top