Use Or in Switch

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
User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Use Or in Switch

Post by Jan Lichtenbelt »

I used some OR statements in a Switch. Up to 5 OR's there was no problem, but then it mentioned that it was not unique anymore. If I put the last OR 32 I get an error message.
Switch_Ors.jpg
Switch_Ors.jpg (59.93 KiB) Viewed 2825 times
(translation: De waarde moet uniek zijn = the value should be unque)

What to do?

Kind regards

Jan

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
Contact:

Re: Use Or in Switch

Post by kersing »

Hi Jan,

In the first case you are probably trying to check if the counter is 17 or 22 or 33. However, what Flowcode reads is you are trying to check if counter is:

Code: Select all

dec      bin
17      0001 0001
22      0001 0110
33      0010 0001
--------------------- OR
55      0011 0111
So it compares your value to 55 (decimal).

When adding the 'OR 32' to the second case the value you are comparing to also becomes 55 so they are no longer unique.

Code: Select all

dec      bin
16    0001 0000
23    0001 0111
32    0010 0000
--------------------  OR
55    0011 0111
If you want to compare all the different values you need to use a case (geval) for each value. Or use decision icons, not a switch.

Jac
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Post Reply