# 연산자

### 설명

연산자는 데이터를 계산하고 비교하는 등의 작업을 하기 위한 기호예요.

한글 코딩에서는 아래와 같은 연산자를 지원해요.

* 산술 연산자
  * <mark style="color:purple;">`+`</mark> : 무언가를 더합니다.
    * 숫자 + 숫자 → 숫자 (10 + 10 → 20)
    * 문자 + 문자 → 문자 ("안녕" + "친구들" → "안녕친구들")
    * 문자 + 숫자 → 문자 ("10" + 20 → "1020")
  * <mark style="color:purple;">`-`</mark> : 숫자를 뺍니다.
    * 숫자 - 숫자 → (10 - 6 → 4)
  * <mark style="color:purple;">`*`</mark> : 무언가를 곱합니다.
    * 숫자 + 숫자 → 숫자 (10 \* 2 → 20)
    * 문자 + 숫자 → 문자 ("안녕" \* 4 → "안녕안녕안녕안녕")
  * <mark style="color:purple;">`/`</mark> : 앞 수에서 뒤 수를 나눕니다.
    * 숫자 + 숫자 → 숫자 (10 / 4 → 2.5)
  * <mark style="color:purple;">`//`</mark> : 앞 수에서 뒤 수를 나누어 몫을 계산합니다.
    * 숫자 + 숫자 → 숫자 (10 // 4 → 2)
  * <mark style="color:purple;">`%`</mark> : 앞 수에서 뒤 수를 나누어 나머지를 계산합니다.
    * 숫자 + 숫자 → 숫자 (10 % 4 → 2)
  * <mark style="color:purple;">`**`</mark> : 앞 수를 뒤 수만큼 제곱합니다.
    * 숫자 + 숫자 → 숫자 (2 \*\* 3 → 8)
* 비교 연산자
  * <mark style="color:purple;">`<`</mark> : 왼쪽 수가 오른쪽 수보다 작은지(미만) 비교합니다.
    * 숫자 < 숫자 → 참/거짓 (3 < 4 → 참)
  * <mark style="color:purple;">`<=`</mark> : 왼쪽 수가 오른쪽 수보다 작거나 같은지(이하) 비교합니다.
    * 숫자 <= 숫자 → 참/거짓 (3 <= 3 → 참)
  * <mark style="color:purple;">`>`</mark> : 왼쪽 수가 오른쪽 수보다 큰지(초과) 비교합니다.
    * 숫자 > 숫자 → 참/거짓 (3 > 4 → 참)
  * <mark style="color:purple;">`>=`</mark> : 왼쪽 수가 오른쪽 수보다 크거나 같은지(이상) 비교합니다.
    * 숫자 >= 숫자 → 참/거짓 (3 >= 3 → 참)
  * <mark style="color:purple;">`==`</mark> : 왼쪽 데이터와 오른쪽 데이터가 같은지 비교합니다.
    * 숫자 == 숫자 → 참/거짓 (3 == 3 → 참)
    * 문자 == 문자 → 참/거짓 ("안녕" == "반가워" → 거짓)
  * <mark style="color:purple;">`!=`</mark> : 왼쪽 데이터와 오른쪽 데이터가 같지 않은지(다른지) 비교합니다.
    * 숫자 != 숫자 → 참/거짓 (3 != 3 → 거짓)
    * 문자 != 문자 → 참/거짓 ("안녕" != "반가워" → 참)
* 논리 연산자
  * <mark style="color:purple;">`이고`</mark>, <mark style="color:purple;">`고`</mark> : 두 개의 비교 연산 결과가 모두 참인지 확인합니다.
    * {비교 연산} 이고/고 {비교 연산}
      * (참 이고 참 → 참)
      * (참 이고 거짓 → 거짓)
      * (거짓 이고 거짓 → 거짓)
  * <mark style="color:purple;">`이거나`</mark>, <mark style="color:purple;">`거나`</mark> : 두 개의 비교 연산 결과 중 하나 이상이 참인지 확인합니다.
    * {비교 연산} 이거나/거나 {비교 연산}
      * (참 이거나 참 → 참)
      * (참 이거나 거짓 → 참)
      * (거짓 이거나 거짓 → 거짓)
  * <mark style="color:purple;">`!`</mark> : 바로 뒤의 내용을 부정(반전)합니다.
    * !{비교 연산}
      * !참 → 거짓
      * !거짓 → 참
    * <mark style="color:purple;">`!!`</mark>를 통해 **이중 부정**을 사용할 수도 있습니다. 아래의 예시 상황을 참고해 주세요.
      * !!참→ 참
      * !!거짓 → 거짓
      * 자세한 내용은 [데이터 종류의 <참/거짓과 관련한 자세한 이야기>](https://codebook.horang.it/000/001#more-story)를 참고해 주세요.

***

### 검색 키워드

더하기, 빼기, 곱하기, 나누기, 비교하기, 크다, 작다, 이상, 이하, 초과, 미만, 같다, 등호, 부등호


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://codebook.horang.it/readme/005.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
