Hi everyone, I tried looking through the official syntax guidelines for this, but I think they only address regular conditional statements or those using “and” only. When checking to see if multiple conditions are met, how would one deal with something like this?
<<if ($name is "Bob" and $intelligence gte 5) or ($name is "Phil")>>
You're a cool dude.
<</if>>
Are the parentheses acceptable here? Will the statement be read correctly–IE only fire if the first two statements combined are true OR if the third is true? And what about for even more complex combinations, such as here?
<<if ($name is "Bob" and $intelligence gte 5) or ($name is "Phil and $charisma gte 10)>>
Etc...
<</if>>
Any help for this neophyte is much appreciated, thank you!
Thank you for taking the time to explain! The operator precedence page that you linked will take some time for me to wrap my head around, but it’s good to know that parentheses/brackets can be used determine the order of evaluation! Am I correct in concluding that multiple “nesting” parentheses would be acceptable when needed, then?
Wherein:
<<if (($name is "Bob" and $intelligence gte 5) and ($lastname is "Beemis" and $charisma gte 10)) or ($name is "Bill")>><</if>>
$name is Bob and $intelligence is greater than or equal to 5
$lastname is Beemis and $charisma is greater than or equal to 5
Yup! Nest them as deeply as you want. Although in practice, if you’re nesting them deeply it can get hard to read and you might want to assign some of the inner parts to a temporary variable, e.g. _smart_Bob or _charismatic_Beemis or something.