Page 1 of 1

Use Or in Switch

Posted: Sun Nov 24, 2013 3:10 pm
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 2940 times
(translation: De waarde moet uniek zijn = the value should be unque)

What to do?

Kind regards

Jan

Re: Use Or in Switch

Posted: Sun Nov 24, 2013 4:37 pm
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