Page 1 of 1

OR operator not working? [resolved]

Posted: Sat Mar 31, 2007 8:38 pm
by Camusensei
Hello, I need to see an application exaple for the "OR" operator...
In an IF function, I tried :

Code: Select all

touche = 1 OR touche = 2 OR touche = 3 OR touche = 4
(was only true if touche = 4)
and

Code: Select all

touche = 1 OR 2 OR 3 OR 4
(was always true)

Perhaps I am not correctly using the "or" operator?
please tell me how to use it!

and I would also like to know if it would work if I tried :

Code: Select all

0<touche<5
or

Code: Select all

1<=touche<=5
thank you in advance

Posted: Sun Apr 01, 2007 9:28 pm
by ALAN_26
HELLO Camusensei


TRY THIS SHULD WORK FINE ON FLOWCODE V3 ONLY !

(touche = 1) OR ( touche = 2) OR (touche = 3) OR ( touche = 4 )

Posted: Sun Apr 01, 2007 9:33 pm
by Camusensei
OH, thank you very much!
I'll try it tomorow and I'll tell you!

see ya!

Posted: Mon Apr 02, 2007 1:21 am
by emad
HELLO Camusensei
If you mean that the variable touche has a value between 0 & 5 then the next code will work fine

IF ( touche >= 0 ) && ( touche <= 5 )

Posted: Mon Apr 02, 2007 9:18 am
by Steve
To add to this, the words "OR" and "AND" are "bitwise" operators (equivalent to the 'C' & and | operators). This was the case in Flowcode v2 and was retained in v3 for backwards compatibility.

In v3, we introduced "logical" operators - these are && and || (the same as in 'C').

Both Alan's and Emad's suggestions should work.

Posted: Thu Apr 05, 2007 8:08 pm
by Camusensei
OK, I tried the first method working fine and I'll use the second I have to use it^^

Thank you very much all of you!