<=
Description
Compares the variable on the left with the value or variable on the right of the operator. Returns true when the operand on the left is less (smaller) than or equal to the operand on the right. Please note that you may compare variables of different data types, but that could generate unpredictable results, it is therefore recommended to compare variables of the same data type including the signed/unsigned type.
Syntax
x <= y; // is true if x is smaller than or equal to y and it is false if x is greater than y
Parameter Values
- x: variable. Allowed data types: int, float, double, byte, short, long.
- y: variable or constant. Allowed data types: int, float, double, byte, short, long.
Example Code
The result on Serial Monitor:
※ NOTES AND WARNINGS:
Negative numbers are smaller than positive numbers.
See Also
- Language : == (equal to)
- Language : > (greater than)
- Language : >= (greater than or equal to)
- Language : < (less than)
- Language : != (not equal to)
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |
Additionally, some links direct to products from our own brand, DIYables.