Scripting Conditional Statements with Logical Expression
Hi All!
I was wondering if anyone else found issues when trying logical expressions like "and" , "or" ?
Example:
if (value > 12)and(value < 24) = true then begin
I can't seem to figure out why I keep running into problems and it will not enter my condition.
Any guesses?
-s
I was wondering if anyone else found issues when trying logical expressions like "and" , "or" ?
Example:
if (value > 12)and(value < 24) = true then begin
I can't seem to figure out why I keep running into problems and it will not enter my condition.
Any guesses?
-s
"Every act of creation is first an act of destruction." -Picasso
Well I guess I solved my issue:
FYI
if (value > 12)and(value < 24) = true then begin
should be
if (value > 12)and(value < 24) then begin
because the boolean is assumed and doesn't need to be defined for the condition.
-s
FYI
if (value > 12)and(value < 24) = true then begin
should be
if (value > 12)and(value < 24) then begin
because the boolean is assumed and doesn't need to be defined for the condition.
-s
"Every act of creation is first an act of destruction." -Picasso
That's correct. You also want to enclose the entire conditional part of the statement in parentheses:
if ((value > 12)and(value < 24)) then begin
I've learned that this gives more consistent results.
if ((value > 12)and(value < 24)) then begin
I've learned that this gives more consistent results.
Regards,
Scott
Scott
Thanks ahonoe,
I kept running into this on many times and couldnt figure out why...lol
Glad finally figured out, makes life easier when scripting.
-s
I kept running into this on many times and couldnt figure out why...lol
Glad finally figured out, makes life easier when scripting.
-s
"Every act of creation is first an act of destruction." -Picasso
True & False do not work as expected... Comparing them to conditions compiles clean, but always returns false.
Address the process rather than the outcome. Then, the outcome becomes more likely. - Fripp
Oddly, comparing them to 1 and 0 seems to work.
Just not conditions.
Just not conditions.
Address the process rather than the outcome. Then, the outcome becomes more likely. - Fripp
I agree shawnb, that's where I was getting confused. I am so used to doing the comparison and defining the result, I didn't expect that a boolean wouldn't need an expected result defined.
-s
-s
"Every act of creation is first an act of destruction." -Picasso
Who is online
Users browsing this forum: No registered users and 11 guests
