Hi Guys
Not sure what is the correct way to do this. I have a variable called Key and a variable called Occupant now what i want is to say if key is > then 1 or key is < than (Occupant + 1) then proceed. I have tried the following key > 0 && Key < (Occupant + 1) key > 0 AND Key < (Occupant + 1) key > 0 OR Key < (Occupant + 1) but not sure which is the best way to do this
Checking Variables
Moderator: Benj
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Checking Variables
Hi Brian,
You will need to use two pipes (|| ) : Which mean logical OR
So you use
Best to separate expressions with brackets.
Note:
You may already know this, but you are able to your variables to the simulation debugger watch window ,so you can check everything is working as expected.
I have explained how to do that in FC6 here.
Its exactly the same method for Flowcode V7
Just curious, but that statement only be false when Key = 1 and Occupant = 0
Is that what you're after?
Martin
You will need to use two pipes (|| ) : Which mean logical OR
So you use
Code: Select all
If: (Key >1) || (key < (Occupant + 1))
Note:
Code: Select all
|| = OR
Code: Select all
&& = AND
Code: Select all
! - NOT
I have explained how to do that in FC6 here.
Its exactly the same method for Flowcode V7
Just curious, but that statement only be false when Key = 1 and Occupant = 0
Is that what you're after?
Martin
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Checking Variables
Hi Brian
All you need to do is use AND (&&) instead of OR.
So:
Martin
Sorry I was taking this as a literal expression :jollybv wrote:if the variable is between 1 & whatever i set the Occupant variable
jollybv wrote: if key is > then 1 or key is < than (Occupant + 1) then proceed.
All you need to do is use AND (&&) instead of OR.
So:
Code: Select all
(Key >= 1) && (key <= Occupant)
Martin