
- Arduino Tutorial
- Arduino - Home
- Arduino - Overview
- Arduino - Board Description
- Arduino - Installation
- Arduino - Program Structure
- Arduino - Data Types
- Arduino - Variables & Constants
- Arduino - Operators
- Arduino - Control Statements
- Arduino - Loops
- Arduino - Functions
- Arduino - Strings
- Arduino - String Object
- Arduino - Time
- Arduino - Arrays
- Arduino Function Libraries
- Arduino - I/O Functions
- Arduino - Advanced I/O Function
- Arduino - Character Functions
- Arduino - Math Library
- Arduino - Trigonometric Functions
- Arduino Advanced
- Arduino - Due & Zero
- Arduino - Pulse Width Modulation
- Arduino - Random Numbers
- Arduino - Interrupts
- Arduino - Communication
- Arduino - Inter Integrated Circuit
- Arduino - Serial Peripheral Interface
- Arduino Projects
- Arduino - Blinking LED
- Arduino - Fading LED
- Arduino - Reading Analog Voltage
- Arduino - LED Bar Graph
- Arduino - Keyboard Logout
- Arduino - Keyboard Message
- Arduino - Mouse Button Control
- Arduino - Keyboard Serial
- Arduino Sensors
- Arduino - Humidity Sensor
- Arduino - Temperature Sensor
- Arduino - Water Detector / Sensor
- Arduino - PIR Sensor
- Arduino - Ultrasonic Sensor
- Arduino - Connecting Switch
- Motor Control
- Arduino - DC Motor
- Arduino - Servo Motor
- Arduino - Stepper Motor
- Arduino And Sound
- Arduino - Tone Library
- Arduino - Wireless Communication
- Arduino - Network Communication
- Arduino Useful Resources
- Arduino - Quick Guide
- Arduino - Useful Resources
- Arduino - Discussion
Arduino - Boolean Operators
Assume variable A holds 10 and variable B holds 20 then −
Operator name | Operator simple | Description | Example |
---|---|---|---|
and | && | Called Logical AND operator. If both the operands are non-zero then then condition becomes true. | (A && B) is true |
or | || | Called Logical OR Operator. If any of the two operands is non-zero then then condition becomes true. | (A || B) is true |
not | ! | Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false. | !(A && B) is false |
Example
void loop () { int a = 9,b = 4 bool c = false; if((a > b)&& (b < a)) c = true; else c = false; if((a == b)|| (b < a)) c = true; else c = false; if( !(a == b)&& (b < a)) c = true; else c = false; }
Result
c = true c = true c = true
arduino_operators.htm
Advertisements