cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

a syntax question

Hello,
Where "lmtr" is an angle type parameter,
is the expression "if 0<lmtr<180 then ...do something"
a valid substitute for and has the same meaning as the expression
"if lmtr >0 AND lmtr<180 then...do something" ?
Thank you,
Peter Devlin
4 Replies 4
Frank Beister
Moderator
I don't think so, because the operators =,<,> are boolean operators and are not a defining statement as RANGE in VALUES.

AC will first calculate 0<lmtr with the result 0 or 1 and then result<180.

0<lmtr<180 = ( (0<lmtr) <180)

lmtr=-10 -> (0<lmtr) =0 -> 0<180=1 -> result true
lmtr=45 -> (0<lmtr) =1 -> 1<180=1 -> result true
lmtr=210 -> (0<lmtr) =0 -> 0<180=1 -> result true

But (0<lmtr) * (lmtr<180) should work:

lmtr=-10 -> 0*1=0 -> result false
lmtr=45 -> 1*1=1 -> result true
lmtr=210 -> 1*0=0 -> result false

or ABS(lmtr-90)<90

But thats all not more readable than (0<lmtr) AND (lmtr<180)
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
Frank,
Thank you very much for your reply.
Very concisely put and answers my question.
Your final statement makes me curious about something.
You wrote: "But thats all not more readable than (0<lmtr) AND (lmtr<180)"
Why are the parentheses necessary ?

Thank you,
Peter Devlin
Frank Beister
Moderator
You wrote: "But thats all not more readable than (0<lmtr) AND (lmtr<180)"
Why are the parentheses necessary ?
They aren', but I like to see the terms visual separated and sometimes I add some clearing parentheses. You are right, 0<lmtr AND lmtr<180 comes to same result. It seems the order is:

^
*/
+-
<>=
AND OR

NOT(), because it's a function, does not need to be set in this order.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
Thanks for the explanation Frank.
Peter Devlin

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!