code samples wiki
If Else Conditional Programming Examples
If ... else examples and documentation links in different programming languages. The examples cover a blackjack scenario and provide deep links to the reference documentation of the programming languages. See wiki article Conditional Programming for general information about conditional statements. The if ... else syntax is also known as "if statement", "conditional statements", "compound statements", "if else structure" or "conditional constructs".
Programming languages
Missing something or found an error? Please contribute by editing and fixing errors or leave a
comment
<c:choose>
<c:when test='${card > 21}'>busted</c:when>
<c:when test='${card == 21}'>won</c:when>
<c:otherwise>continue</c:otherwise>
</c:choose>
J2EE 1.4 Tutorial, Core Tag Library
if ($card > 21) {
echo "busted";
<script> alert ("yes"); </script>
} else if ($card == 21) {
echo "won";
<script> alert ("yes"); </script>
} else {
echo "continue";
<script> alert ("yes"); </script>
}
PHP Manual, Control Structures
if (card > 21) {
Console.WriteLine("busted");
} else if (card == 21) {
Console.WriteLine("won");
} else {
Console.WriteLine("continue");
}
C# Language Reference, if-else
cmp dword [card], 21
je @f
jl @continue
;; busted
jmp @out
@@:
;; won
jmp @out
@continue:
;; continue
@out:
if {$card > 21} {
puts stdout "busted"
} elseif {$card == 21} {
puts stdout "won"
} else {
puts stdout "continue"
}
Tcl Documentation, if