<=

설명

왼쪽 변수와 연산자 오른쪽 변수를 비교. 왼쪽 피연산자가 오른쪽 피연산자보다 작거나 같으면 true 반환.

문법

x <= y; // is true if x is smaller than or equal to y and it is false if x is greater than 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 less than or equal to y"); } void loop() { }

시리얼 모니터에 결과:

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
Arduino Uno
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino Uno' on 'COM15')
New Line
9600 baud
x is less than or equal to y
Ln 11, Col 1
Arduino Uno on COM15
2

※ 주의 및 경고:

음수는 양수보다 작다.

더보기

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 .

※ OUR MESSAGES