Conditional structures: Difference between revisions
Content added Content deleted
m (removed extra </lang>) |
(Tern Programming Language) |
||
Line 5,865: | Line 5,865: | ||
}</lang> |
}</lang> |
||
Note that the <tt>switch</tt> command can also use glob matching (like <tt>case</tt> in the Bourne Shell) or regular-expression matching. |
Note that the <tt>switch</tt> command can also use glob matching (like <tt>case</tt> in the Bourne Shell) or regular-expression matching. |
||
=={{header|Tern}}== |
|||
There are several conditional statements. |
|||
===If Statement=== |
|||
<lang tern>if(a > b) |
|||
println(a);</lang> |
|||
===If Else Statement=== |
|||
<lang tern>if(a > b) { |
|||
println(a); |
|||
} else { |
|||
println(b); |
|||
}</lang> |
|||
===Unless Statement=== |
|||
<lang tern>unless(a > b) { |
|||
println(b); |
|||
} else { |
|||
println(a); |
|||
}</lang> |
|||
===Switch Statement=== |
|||
<lang tern>switch(a) { |
|||
case 10: |
|||
case 11: |
|||
println(a); |
|||
break; |
|||
default: |
|||
println(b); |
|||
}</lang> |
|||
=={{header|TI-83 BASIC}}== |
=={{header|TI-83 BASIC}}== |