Hi, I may just be being paranoid. But would appreciate a more experienced coder having a peek.
*if ((((var = false) and (var = true)) and (var = “female”)) or (var = “both”))
I am hoping this is a command that dictates the first two variables must meet the conditions, but either of the last two will do to make it valid. Can someone let me know if I have messed up the parenthesis please? I know there were other posts on parenthesis, but they all seemed to contain or or and, no combinations. So please don’t beat me if this has been covered.
I assume that “var” actually represents a bunch of different variables? Might be clearer for examples like this if you differentiate them e.g. (var1=true) and (var2=false).
I think what you’ve got there is in danger of triggering if the last variable is “both”, regardless of what’s happening with the other variables. For what you describe, I suspect this would work better:
*if ((var1 = false) and (var2 = true)) and ((var3 = “female”) or (var3 = “both”))
Note that if var3 is a sexual orientation variable with three possible values (male, female, or both), you could more simply use (var3 != “male”) instead of =“female” or =“both”. The exclamation point means not, i.e. var3 is not equal to male.
Have a look at this post for a walkthrough of a mixed or/and condition:
Many thanks. All your assumptions were correct, and those parenthesis make much more sense. Also for the exclamation mark. I didn’t know it could be used that way. It did seem like a lot of work to set if her boyfriend is dead and you aren’t sleeping with her friend she will hit on you if your orientation is correct. I don’t know why I bothered adding in orientation anyway. Should have just left it as a free for all… Thanks again.