Page 1 of 1

IF function

Posted: Fri Nov 15, 2013 1:07 pm
by echase
What is correct syntax for:

IF variable = 160 OR 192

I thought I put this statement inside the IF icon:

variable = 160 || 192

but I find that pretty much any value of the variable leads to the Yes branch and not just 160 or 192. All other values should lead to the No branch.

Re: IF function

Posted: Fri Nov 15, 2013 1:19 pm
by kersing
The correct way to do this is:
variable = 160 || variable = 192

Your expression evaluates to:
IF (variable = 160) OR (192)
As 192 is not zero the result is always true, resulting in a 'Yes' branch.

Re: IF function

Posted: Fri Nov 15, 2013 1:37 pm
by echase
Many thanks.

Would be useful to put this in the Help file. I could find some limited info on AND, OR, etc. functions there but not much.

Re: IF function

Posted: Fri Nov 15, 2013 5:14 pm
by dazz
Hi
look in the boost c directory \Flowcode\v5\Tools\boostc and ther5s a manual that give some examples etc
ive attached it below
Regards
Dazz
boostc.pdf
(635.25 KiB) Downloaded 333 times

Re: IF function

Posted: Sat Nov 16, 2013 6:19 pm
by echase
A related question. What is syntax for negative numbers?

In normal maths -20 is less than -10. But if I use in the IF icon:

variable<-10

and the variable =-20 it does not appear to return the yes answer.

I find I have to invert the numbers into positive numbers and do a more than rather than a less than test. But that uses more time/memory. Is there a simpler way?

Re: IF function

Posted: Sat Nov 16, 2013 6:50 pm
by medelec35
The more minus you go the lower the number.
So -20 is less then -10

-10 is greater than -20

Martin

Re: IF function

Posted: Sat Nov 16, 2013 6:53 pm
by echase
Think I was wrong. Got cofused by too much use of negative numbers