ID:269169
 
I cant get variables to work! All I want is a simple if (variable) = 1 line but...
Perpetr8r the Perpetu8r wrote:
I cant get variables to work! All I want is a simple if (variable) = 1 line but...

 if(!variable)
//other misc. coding


or

 if(variable == 1)
//other misc. coding


It is not recommended to use if statements all the time though.
Perpetr8r the Perpetu8r wrote:
I cant get variables to work! All I want is a simple if (variable) = 1 line but...

I suspect what you mean is if(var) to see if a var is true. Or there's if(var==1) to see if it's exactly 1. If your value is only a true/false value, use if(var) which is safer. Likewise use if(!var) to see if it's false.

Lummox JR
In response to AW3 Team
AW3 Team wrote:
It is not recommended to use if statements all the time though.

Uh, that makes no sense. Although I'm aware it's plenty possible to use if() statements in ridiculous places where they're not needed, that sort of thing is more or less obvious. I'm not sure where this thing about ifs not being recommended comes from.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
AW3 Team wrote:
It is not recommended to use if statements all the time though.

Uh, that makes no sense. Although I'm aware it's plenty possible to use if() statements in ridiculous places where they're not needed, that sort of thing is more or less obvious. I'm not sure where this thing about ifs not being recommended comes from.

Lummox JR

Very true LJR.