비교 연산자

Jmnote (토론 | 기여)님의 2019년 5월 19일 (일) 23:10 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

relational operator, comparison operator
關係 演算子, 比較 演算子
관계 연산자, 비교 연산자
  • 두 값을 비교하는 연산자
  • 둘의 관계를 조사하는 연산자
  • 피연산자들을 비교하고 그 결과 논리값을 반환하는 연산자
  • 산술이나 문자로 구성된 항목 간의 비교를 위하여 사용하는 연산자
  • 예: 등호, 부등호

2 목록[ | ]

연산자 이름 설명
a == b 같음 a와 b의 값이 같으면 true
a === b 엄밀히 같음 a와 b의 값이 같고 자료형도 같으면 true
a != b 같지 않음 a와 b의 값이 다르면 true
a !== b 엄밀히 같지 않음 a와 b의 값이 다르거나 자료형이 다르면 true
a < b 작음 a가 b보다 작으면 true
a <= b 작거나 같음 a가 b보다 작거나 같으면 true
a > b a가 b보다 크면 true
a >= b 크거나 같음 a가 b보다 크거나 같으면 true

3 언어별[ | ]

주요 관계 연산자
Convention 같음 같지 않음 보다 큼 보다 작음 크거나 같음 작거나 같음
In print = > <
Fortran [1] .EQ. .NE. .GT. .LT. .GE. .LE.
== /= > < >= <=
ALGOL 68 [2] = > <
/= >= <=
eq ne gt lt ge le
BASIC-like[3] = <> > < >= <=
MUMPS = '= > < '< '>
Pascal-like[4] = <> > < >= <=
C-like[5] == != > < >= <=
Bourne-like shells [6] -eq -ne -gt -lt -ge -le
Batch file EQU NEQ GTR LSS GEQ LEQ
MATLAB[7] == ~= > < >= <=
eq(x,y) ne(x,y) gt(x,y) lt(x,y) ge(x,y) le(x,y)
Mathematica[8] == != > < >= <=
Equal[x,y] Unequal[x,y] Greater[x,y] Less[x,y] GreaterEqual[x,y] LessEqual[x,y]

4 같이 보기[ | ]

5 참고[ | ]

  1. Second row of operators introduce with Fortran 90.
  2. ALGOL 68: "stropping" regimes are used in code on platforms with limited character sets (e.g. use >= or GE instead of ), platforms with no bold emphasis (use 'ge'), or platforms with only UPPERCASE (use .GE or 'GE').
  3. Including Visual Basic .NET, OCaml, SQL, Standard ML, and others.
  4. Including Algol, Simula, Modula-2, Delphi, OCaml, Standard ML, Eiffel, APL and others.
  5. Including C, C++, C#, Go, Java, JavaScript, Perl (numerical comparison only), PHP, Python, Ruby, and R.
  6. Including Bourne shell, Bash, Korn shell, and Windows PowerShell. The symbols < and > are usually used in a shell for redirection, so other symbols need to be used. Without the hyphen, is used in Perl for string comparison.
  7. MATLAB, although in other respects using similar syntax as C, does not use !=, as ! in MATLAB sends the following text as a command line to the operating system. The first form is also used in Smalltalk, with the exception of equality, which is =.
  8. Relational and Logical Operators of Mathematica
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}