{{위키데이터 속성 추적}}
[[컴퓨터 과학]]에서 '''관계연산자'''(relational operator)는 '두 개의 값을 비교해 그들간의 관계를 평가'하는 연산자로, [[이진 함수|2개의 실체]] 간의 특정한 종류의 [[이항관계|관계]]를 시험하거나 정의하는 [[프로그래밍 언어]] 구조체 또는 [[연산자 (프로그래밍)|연산자]]이다. 여기에는 숫자의 [[등식]](예: {{nowrap|5 &#61; 5}})이나 [[부등식]](예: {{nowrap|4 ≥ 3}})이 포함된다.

== 표준 관계연산자 ==
프로그래밍 언어에 쓰이는 가장 흔한 숫자 관계연산자는 아래와 같다.

{| class="wikitable" style="text-align: center;"
|+ 공통 관계 연산자
! 규칙
! 같음
! 같지 않음
! 보다 큼
! 보다 작음
! 보다 크거나<br />같음
! 보다 작거나<br />같음
|-
! 인쇄물
| =
| ≠
| &gt;
| &lt;
| ≥
| ≤
|-
![[포트란]]<ref group="note">Including FORTRAN II, III, IV, 66 and 77.</ref>
| <code>.EQ.</code>
| <code>.NE.</code>
| <code>.GT.</code>
| <code>.LT.</code>
| <code>.GE.</code>
| <code>.LE.</code>
|-
! rowspan=3 | [[알골 68]]<ref group="note">[[ALGOL 68]]: ''[[:en:Stropping (syntax)|stropping]]'' regimes are used in code on platforms with limited character sets (''e.g.'', use <code>>=</code> or <code>GE</code> instead of <code>≥</code>), platforms with no <code>'''bold'''</code> [[:en:Emphasis (typography)|emphasis]] (use <code>'ge'</code>), or platforms with only [[대소문자|UPPERCASE]] (use <code>.GE</code> ''or'' <code>'GE'</code>).</ref>
|rowspan=2| <code>=</code>
| <code>≠</code>
|rowspan=2| <code>&gt;</code>
|rowspan=2| <code>&lt;</code>
| <code>≥</code>
| <code>≤</code>
|-
| <code>/=</code>
| <code>&gt;=</code>
| <code>&lt;=</code>
|-
| <code>'''eq'''</code>
| <code>'''ne'''</code>
| <code>'''gt'''</code>
| <code>'''lt'''</code>
| <code>'''ge'''</code>
| <code>'''le'''</code>
|-
! [[APL (프로그래밍 언어)|APL]]
| <code>=</code>
| <code>≠</code>
| <code>&gt;</code>
| <code>&lt;</code>
| <code>≥</code>
| <code>≤</code>
|-
! [[베이직]], [[ML (프로그래밍 언어)|ML]], [[파스칼 (프로그래밍 언어)|파스칼]]<ref group="note">Including [[ALGOL]], [[Simula]], [[Modula-2]], [[Eiffel]], [[SQL]], [[스프레드시트|spreadsheet formulas]], and others.</ref>
| <code>=</code>
| <code>&lt;&gt;</code>
| <code>&gt;</code>
| <code>&lt;</code>
| <code>&gt;=</code>
| <code>&lt;=</code>
|-
! [[MUMPS]]
| <code>=</code>
| <code>'=</code>
| <code>&gt;</code>
| <code>&lt;</code>
| <code>'&lt;</code>
| <code>'&gt;</code>
|-
! [[루아 (프로그래밍 언어)|루아]]
| <code>==</code>
| <code>~=</code>
| <code>&gt;</code>
| <code>&lt;</code>
| <code>&gt;=</code>
| <code>&lt;=</code>
|-
! [[C (프로그래밍 언어)|C 계열]]<ref group="note">[[C (프로그래밍 언어)|C]], [[C++]], [[C 샤프|C#]], [[Go (프로그래밍 언어)|Go]], [[자바 (프로그래밍 언어)|자바]], [[자바스크립트]], [[펄]] (숫자 비교만), [[PHP]], [[파이썬]], [[루비 (프로그래밍 언어)|루비]], [[R (프로그래밍 언어)|R]] 포함.</ref>
| <code>==</code>
| <code>!=</code>
| <code>&gt;</code>
| <code>&lt;</code>
| <code>&gt;=</code>
| <code>&lt;=</code>
|-
! [[유닉스 셸|본 계열]] [[셸]]<ref group="note">[[본 셸]], [[배시]], [[콘 셸]], [[윈도우 파워셸]] 포함. The symbols <code>&lt;</code> and <code>&gt;</code> are usually used in a shell for [[리다이렉션|redirection]], so other symbols must be used. Without the hyphen, is used in [[Perl]] for string comparison.</ref>
| <code>-eq</code>
| <code>-ne</code>
| <code>'''-gt'''</code>
| <code>-lt</code>
| <code>-ge</code>
| <code>-le</code>
|-
! [[배치 파일]]
| <code>EQU</code>
| <code>NEQ</code>
| <code>GTR</code>
| <code>LSS</code>
| <code>GEQ</code>
| <code>LEQ</code>
|-
! rowspan="2" |[[MATLAB]]<ref group="note">MATLAB, although in other respects using similar syntax as C, does not use <code>!=</code>, as <code>!</code> in MATLAB sends the following text as a command line to the [[operating system]]. The first form is also used in [[스몰토크]], with the exception of equality, which is <code>=</code>.</ref>
| <code>==</code>
| <code>~=</code>
| <code>&gt;</code>
| <code>&lt;</code>
| <code>&gt;=</code>
| <code>&lt;=</code>
|-
| <code>eq(x,y)</code>
| <code>ne(x,y)</code>
| <code>gt(x,y)</code>
| <code>lt(x,y)</code>
| <code>ge(x,y)</code>
| <code>le(x,y)</code>
|-
! [[포트란 90]]<ref group="note">Including FORTRAN 95, 2003, 2008 and 2015.</ref>, [[하스켈]]
| <code>==</code>
| <code>/=</code>
| <code>&gt;</code>
| <code>&lt;</code>
| <code>&gt;=</code>
| <code>&lt;=</code>
|-
! rowspan="2" |[[매스매티카]]<ref>[http://reference.wolfram.com/mathematica/tutorial/RelationalAndLogicalOperators.html Relational and Logical Operators] of [[Mathematica]]</ref>
| <code>==</code>
| <code>!=</code>
| <code>&gt;</code>
| <code>&lt;</code>
| <code>&gt;=</code>
| <code>&lt;=</code>
|-
| <code>Equal[x,y]</code>
| <code>Unequal[x,y]</code>
| <code>Greater[x,y]</code>
| <code>Less[x,y]</code>
| <code>GreaterEqual[x,y]</code>
| <code>LessEqual[x,y]</code>
|}

== 같이 보기 ==
* [[이항 관계]]
* [[조건문]]
* [[등식]]
* [[등호]]
* [[연산 (수학)]]
* [[연산자]]
* [[연산자 (프로그래밍)]]
== 각주 ==
=== 내용주 ===
<references group="note"/>

=== 참조주 ===
{{각주}}

[[분류:연산자 (프로그래밍)]]
[[분류:이항연산]]