!=
설명
왼쪽 변수와 연산자 오른쪽 변수를 비교. 두 피연산자가 같지 않으면 true 반환.
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.
문법
x != y; // x와 y가 같으면 거짓, x와 y가 같지 않으면 참
매개변수
- x: 변수. 허용되는 자료형: int, float, double, byte, short, long
- y: 변수 또는 상수. 허용되는 자료형: int, float, double, byte, short, long
예제 코드
void setup() {
Serial.begin(9600);
int x = 1;
int y = 2;
if (x != y) // x 가 y 와 같지 않으면
Serial.println("x is NOT equal to y");
else
Serial.println("x is equal to y");
}
void loop() {
}
시리얼 모니터에 결과:
COM6
x is NOT equal to y
Autoscroll
Clear output
9600 baud
Newline
더보기
- 언어 : == (같음)
- 언어 : > (보다 큼)
- 언어 : >= (크거나 같음)
- 언어 : < (보다 작음)
- 언어 : ≤ (작거나 같음)
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |
Disclosure: Some links in this section are Amazon affiliate links. If you make a purchase through these links, we may earn a commission at no extra cost to you.
Additionally, some links direct to products from our own brand, DIYables.
Additionally, some links direct to products from our own brand, DIYables.