주 메뉴 열기

바뀜

5,420 바이트 추가됨 ,  3년 전
편집 요약 없음
</syntaxhighlight>
|}
 
== 언어별 비교 참조 ==
{| class="wikitable"
|-
! rowspan=2 | [[프로그래밍 언어]]
! colspan=3 | 구조화된 if
! rowspan=2 | [[switch 문|switch]] 선택
! rowspan=2 | 산술 if
! rowspan=2 | 패턴 일치{{ref label|pattern matching|A|none}}
|-
! then
! else
! else–if
|-
|{{rh}}| [[에이다]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[C (프로그래밍 언어)|C]], [[C++]]
| {{yes}}
| {{yes}}
| {{no|불필요}}{{ref label|choice else if|B|1}}
| {{yes|Fall-through}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[C 샤프]]
| {{yes}}
| {{yes}}
| {{no|불필요}}{{ref label|choice else if|B|2}}
| {{yes}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[코볼]]
| {{yes}}
| {{yes}}
| {{no|불필요}}{{ref label|choice else if|B|2}}
| {{yes}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[에펠]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes|[[switch 문|예]]}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[F 샤프|F#]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{no|불필요}}{{ref label|choice const|C|1}}
| {{no}}
| {{yes}}
|-
|{{rh}}| [[포트란 90]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
|-
|{{rh}}| [[고]]
| {{yes}}
| {{yes}}
| {{no|불필요}}{{ref label|choice else if|B|1}}
| {{yes}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[하스켈]]
| {{yes}}
| {{yes|필요}}
| {{no|불필요}}{{ref label|choice else if|B|3}}
| {{no|불필요}}{{ref label|choice const|C|2}}
| {{no}}
| {{yes}}
|-
|{{rh}}| [[자바 (프로그래밍 언어)|자바]]
| {{yes}}
| {{yes}}
| {{no|불필요}}{{ref label|choice else if|B|4}}
| {{yes|Fall-through}}<ref name="JLS">[http://java.sun.com/docs/books/jls/download/langspec-3.0.pdf Java.sun.com], Java Language Specification, 3rd Edition.</ref>
| {{no}}
| {{no}}
|-
|{{rh}}| [[ECMAScript]] ([[자바스크립트]])
| {{yes}}
| {{yes}}
| {{no|불필요}}{{ref label|choice else if|B|5}}
| {{yes|Fall-through}}<ref name="ECMA-262">[http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf Ecma-international.org] ECMAScript Language Specification, 5th Edition.</ref>
| {{no}}
| {{no}}
|-
|{{rh}}| [[메스메티카]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
| {{yes}}
|-
|{{rh}}| [[오베론]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[펄]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[PHP]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes|Fall-through}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[파스칼 (프로그래밍 언어)|파스칼]], [[오브젝트 파스칼]] ([[델파이]])
| {{yes}}
| {{yes}}
| {{no|불필요}}
| {{yes}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[파이썬]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[퀵베이직]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[루비 (프로그래밍 언어)|루비]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
| {{yes|<code>case</code> w/ [[정규 표현식|Regexp]]}}{{ref label|case regexp|D|none}}
|-
|{{rh}}| [[스칼라]]
| {{yes}}
| {{yes}}
| {{no|불필요}}{{ref label|choice else if|B|4}}
| {{yes|Fall-through}}
| {{no}}
| {{yes}}
|-
|{{rh}}| [[SQL]]
| {{yes}}{{ref label|SQL|S|1}}
| {{yes}}
| {{yes}}
| {{yes}}{{ref label|SQL|S|2}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[비주얼 베이직]], 클래식
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[비주얼 베이직 닷넷]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes}}
| {{no}}
| {{no}}
|-
|{{rh}}| [[윈도우 파워셸]]
| {{yes}}
| {{yes}}
| {{yes}}
| {{yes|Fall-through}}
| {{no}}
| {{no}}
|}
 
== 각주 ==
; 내용주
<ol type="A">
<small>
<li> {{note label|pattern matching|A|none}} This refers to pattern matching as a distinct conditional construct in the programming language – as opposed to mere string pattern matching support, such as [[정규 표현식|regular expression]] support.</li>
<li> {{note label|choice else if|B|1}} {{note label|choice else if|B|2}} {{note label|choice else if|B|3}} {{note label|choice else if|B|4}} {{note label|choice else if|B|5}}The often-encountered <code>else if</code> in the C family of languages, and in COBOL and Haskell, is not a language feature but a set of nested and independent ''if then else'' statements combined with a particular source code layout. However, this also means that a distinct else–if construct is not really needed in these languages.</li>
<li> {{note label|choice const|C|1}} {{note label|choice const|C|2}} In Haskell and F#, a separate constant choice construct is unneeded, because the same task can be done with pattern matching.</li>
<li> {{note label|case regexp|D|none}} In a Ruby <code>case</code> construct, [[정규 표현식|regular expression]] matching is among the conditional flow-control alternatives available. For an example, see [http://stackoverflow.com/questions/6803647/how-to-write-a-ruby-switch-statement-case-when-with-regex-and-backreferences this] Stack Overflow question.</li>
<li> {{note label|SQL|S|1}}{{note label|SQL|S|2}} SQL has two similar constructs that fulfill both roles, both introduced in [[SQL-92]]. A "searched <code>CASE</code>" expression <code>CASE WHEN cond1 THEN expr1 WHEN cond2 THEN expr2 [...] ELSE exprDflt END</code> works like <code>if ... else if ... else</code>, whereas a "simple <code>CASE</code>" expression: <code>CASE expr WHEN val1 THEN expr1 [...] ELSE exprDflt END</code> works like a switch statement. For details and examples see [[Case (SQL)]].</li>
</small>
</ol>
 
== 바깥 고리 ==