Yeah, I sorta am too... I think Yggdrasil might be best able to put that structure into "english" without mangling it.smurfier wrote:I understand your PM, I just wanted to hide my "duh" moment behind closed doors.
I just need to understand that particular like of shorthand because I feel really bad "publishing" a line of code that I don't understand. Also, I've been reading the tutorial, I'm just one that needs to learn things the hard way.
In general though it is much like "MeasureTemp <= 33 ? 1 : 0" in a Calc measure. If the "conditional" evaluates to "true" it returns the first value, otherwise it returns the second.
From a different guide:
Another useful idiom is (a and b)or c (or simply a and b or c, because and
has a higher precedence than or), which is equivalent to the C expression a?b:c,
provided that b is not false. For instance, we can select the maximum of two
numbers x and y with a statement like
max = (x > y) and x or y
When x>y, the frst expression of the and is true, so the and results in its second
expression (x), which is always true (because it is a number), and then the or
expression results in the value of its frst expression, x. When x>y is false, the
and expression is false and so the or results in its second expression, which is y.
If you look at that last paragraph with your head tilted just slightly sideways, you can see why the "and" and "or" are used in the expression. if the "and x" evaluates to "false" (as it would if y is bigger than x) then "y" is returned.
This is equivalent to:
if x > y then
max = x
max = y