Conditional && and ||
I found the post that spelled out how to perform logical comparisons, but I cannot find how to perform AND and OR statements to combine booleans in an IF statement. Can anyone provide an example or a link to a good tutorial with an example of && and ||?
|
What do && and || mean? You'll never see a doubled character as a operator in HL's scripting language. Do you just mean & and |, and you're pulling in terms from another language?
Also, do you want to use booleans with a script, or are you using booleans in a tag expression? The answer is different in each case If your question is about tag expressions, here's that section of the wiki: http://hlkitwiki.wolflair.com/index....ag_Expressions For scripts, you'll have to be clever with addition and subtraction and multiplication, because the standard if () then can't take booleans. But, if (A + B <> 0) then ends up meaning A or B, as long as both A and B are things that are false at 0 and true if <> 0, and if (A + B = 2) then ends up meaning A & B, as long as both A and B are things that are false at 0 and true at 1 (but in this case, it doesn't work if they can be values > 1). |
Quote:
FYI ISO standards for SQL uses || to concatenate strings together. The fun of working in many different languages. :D |
Suppose I have a numeric variable "delta" and I want to test to see if it is within a given range:
Code:
if (delta > 3 AND delta <=6) then Suppose I want to know if delta is one of two values: Code:
if (delta = 3 OR delta = 6) then |
For AND
Code:
if (delta > 3) then Code:
if (delta = 3) then |
Quote:
To summarize the takeaway from this, I need to nest any if statements for logical AND or OR? |
Depending on how things are stored, tagexpr may work:
Code:
if (tagexpr[(fieldval:trtUser >= 3) & (fieldval:trtUser <= 6)] <> 0) then |
All times are GMT -8. The time now is 12:10 PM. |
Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.