Check two variables?

Non-platform specific questions.

Check two variables?

Postby ThaKid244 » Sat Jul 30, 2011 3:51 am

Hey all,

I was wondering if it is possible to check two variables as in the example:

if (Wall == 2)
{
if (InvGas == 0)
{
DestroyActor("GasCan");
}
}

Thank you.
K Thanks! ;)
User avatar
ThaKid244
 
Posts: 34
Joined: Thu Dec 23, 2010 6:40 pm
Score: 0 Give a positive score

Re: Check two variables?

Postby DST » Sat Jul 30, 2011 4:30 am

if (Wall == 2 && InvGas ==0){
}

&& = and this is true

|| = or this is true

you can combine them

if(Wall == 2 && InvGas ==0 || Wall == 100000 && InvGas == 2){

will occur if everything before the || is true OR if everything after the || is true.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Check two variables?

Postby ThaKid244 » Sat Jul 30, 2011 11:39 am

Okay thank you DST
K Thanks! ;)
User avatar
ThaKid244
 
Posts: 34
Joined: Thu Dec 23, 2010 6:40 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest