IF function

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times

IF function

Post 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.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: IF function

Post 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.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times

Re: IF function

Post 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.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: IF function

Post 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
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times

Re: IF function

Post 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?

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: IF function

Post by medelec35 »

The more minus you go the lower the number.
So -20 is less then -10

-10 is greater than -20

Martin
Martin

echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times

Re: IF function

Post by echase »

Think I was wrong. Got cofused by too much use of negative numbers

Post Reply