Hi Steve or ben
Is it possible to make an if statement for these 2 factions using 1 if statement for each function ?
--> If variable is between 22 and 33
--> If variable is 2 or 5 or 44
I need to make this function to interface a 4 wire resistive touch screen , it produces
An X and Y voltages which are going to be connected to the pic ADC’s than converted To variables .
Thank in advance
Regards, Alan cilia
IF Statement help
Re: IF Statement help
Steve Could you explain the above statement a little more.steve wrote:Note that the word "AND" is used for a "bitwise" AND in all Flowcode versions.
Also I would like to know how to use OR in an if icon i.e is this right: -
decision - a=b OR c=5
Ondra
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: IF Statement help
bitwise operators:
0x31 AND 0x25 = 0x21
0x31 OR 0x25 = 0x35
For "logical" operations (e.g. "if someting is true and something else is true"), you need to use "&&" and "||":
if (a = 5) && (b = 3)
if (a = b) || (c = 5)
In this code, "false" is zero and "true" is non-zero. So, if a was equal to 5, "a=5" would equal 1. If a was 6 or 7, "a=5" would equate to zero.
Why don't you experiment with the simulation. That will help you understand how things work. Also, I'm sure there have been other posts about this subject in the past.
0x31 AND 0x25 = 0x21
0x31 OR 0x25 = 0x35
For "logical" operations (e.g. "if someting is true and something else is true"), you need to use "&&" and "||":
if (a = 5) && (b = 3)
if (a = b) || (c = 5)
In this code, "false" is zero and "true" is non-zero. So, if a was equal to 5, "a=5" would equal 1. If a was 6 or 7, "a=5" would equate to zero.
Why don't you experiment with the simulation. That will help you understand how things work. Also, I'm sure there have been other posts about this subject in the past.