• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

another quick newb C question

alyarb

Platinum Member
Is it possible to say

if var1=x and var2=y {then do this;}

such that two conditions must be met for a function to be performed? thanks
 
if ((var1 == x) and (var2 == y)) {
do stuff;
}

That should work. The short hand is

if ((var1 == x) && (var2 == y)){
do stuff;
}
 
You don't need the inner sets of () in your case, he just put them there for readability. Boolean operators have an order of precedence, && before ||. So if you have a complex if statement you'll need to use ( ) to control the order of operations of the boolean statement.

Foe example.

(x == a || (x == b && y == a)) is the same as (x == a || x == b && y == a).

However, those are both different from ((x == a || x == b) && y == a)
 
Back
Top