OR operator not working? [resolved]

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Camusensei
Posts: 7
Joined: Sat Mar 31, 2007 8:29 pm
Contact:

OR operator not working? [resolved]

Post 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
Last edited by Camusensei on Thu Apr 05, 2007 8:09 pm, edited 1 time in total.

ALAN_26
Posts: 84
Joined: Sat Apr 29, 2006 3:36 pm
Location: MALTA
Contact:

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

Camusensei
Posts: 7
Joined: Sat Mar 31, 2007 8:29 pm
Contact:

Post by Camusensei »

OH, thank you very much!
I'll try it tomorow and I'll tell you!

see ya!

emad
Posts: 2
Joined: Sat Oct 29, 2005 3:36 pm
Contact:

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

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

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

Camusensei
Posts: 7
Joined: Sat Mar 31, 2007 8:29 pm
Contact:

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

Post Reply