# Multiple Variables for *if statements

#1

Is it possible to have something like:

*if (condition_one), (condition_2)

Where you are asking if both variables are true? i.e, in this example if condition_one AND condtion_two are true.

Thanks!

#2

I always have trouble getting things to depend on multiple variables but i think its

*if (something =true) and (thing =true)

Can someone say if i am right?

#3

Reaperoa told me that it should be like this:

*if ((some_shit = true) and (other_shit = true)).

A parenthesis for every two variables.

#4

i thought that was only if it was a *selectable_if ?

#5

Iâ€™ve gotten into the habit of doing all multiple conditions as ScarletGeisha shows there, with extra parenthesis around each pair, as that way avoids any problems. The only thing to watch out for (as it wonâ€™t be an error, just an incorrect calculation) is the different between AND & OR when both are used within the same condition. Double-check your logic on those (or even run some tests) to make sure the condition is saying exactly what itâ€™s supposed to in all cases.

â€¦Youâ€™ll understand that better when youâ€™re using 4+ conditions for a single *if and are mixing ANDs & ORs on the same line!

#6

@appleduck28 Technically, you donâ€™t need the outer parentheses if youâ€™re just using an *if (although you do need them around each equation), so:

*if (foo = true) and (bar = true)

does work. But there are some cases (like using *selectable_if) where you do need the outer parentheses, so itâ€™s usually a good habit to get into (particularly as the extra parentheses never hurt).

@Daemonion There are two things to remember that arenâ€™t always mentioned though: The first thing to remember is that each AND/OR will only connect two equations, so if you want to check if all of foo, bar and bat are true youâ€™ll need to use:

*if ((foo = true) and (bar = true)) and (bat = true)

(Bolded the parenthese that are necessary but very easy to forget.)

The other thing to remember is (as mentioned by @Vendetta) mixing and matching AND/OR with the correct order of parentheses can be confusing at the best of times. Once you get a hand on how the logic works though, you may be surprised at how simple it can be, but while starting out, youâ€™ll probably want to stick with each *if command only use AND or OR.

Children of the Gods (Important poll #12306)
#7

Excellent. I havenâ€™t even used any OR statements yet.

Are these scenarios possible:

*if ((one = true) and (two = true)) and ((three = true) and (four = true))
stuff

*if ((you_killed_spongebob = true) or (reaperoa_killed_spongebob = true))

#8

Yep, both are fine. In the first example, *if is true only if all four of those conditions are true, whereas in the second example *if is true if either one of those conditions is.

#9

Awesome! Thanks, guys!

#10

hey everyone, no matter what i try, the if command does not seem to take the stats into account, ive tried

if var = 80 and if var >80, even if var >=80

#11

Either of those should work if the code surrounding it works like it should, but letâ€™s keep this discussion on one thread, shall we?

#12

sure thing, no problem