<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
conditionals	B-Language
(	O
that	O
is	O
,	O
conditional	B-Language
statements	O
,	O
conditional	B-Language
expressions	O
and	O
conditional	B-Language
constructs	O
)	O
are	O
programming	O
language	O
commands	O
for	O
handling	O
decisions	O
.	O
</s>
<s>
Specifically	O
,	O
conditionals	B-Language
perform	O
different	O
computations	O
or	O
actions	O
depending	O
on	O
whether	O
a	O
programmer-defined	O
Boolean	O
condition	O
evaluates	O
to	O
true	O
or	O
false	O
.	O
</s>
<s>
In	O
terms	O
of	O
control	O
flow	O
,	O
the	O
decision	O
is	O
always	O
achieved	O
by	O
selectively	O
altering	O
the	O
control	O
flow	O
based	O
on	O
some	O
condition	O
(	O
apart	O
from	O
the	O
case	O
of	O
branch	B-General_Concept
predication	I-General_Concept
)	O
.	O
</s>
<s>
Although	O
dynamic	O
dispatch	O
is	O
not	O
usually	O
classified	O
as	O
a	O
conditional	B-Language
construct	O
,	O
it	O
is	O
another	O
way	O
to	O
select	O
between	O
alternatives	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
In	O
imperative	B-Application
programming	I-Application
languages	I-Application
,	O
the	O
term	O
"	O
conditional	B-Language
statement	O
"	O
is	O
usually	O
used	O
,	O
whereas	O
in	O
functional	B-Language
programming	I-Language
,	O
the	O
terms	O
"	O
conditional	B-Language
expression	O
"	O
or	O
"	O
conditional	B-Language
construct	O
"	O
are	O
preferred	O
,	O
because	O
these	O
terms	O
all	O
have	O
distinct	O
meanings	O
.	O
</s>
<s>
The	O
if	O
–	O
then	O
construct	O
(	O
sometimes	O
called	O
if	B-Language
–	I-Language
then	I-Language
–	I-Language
else	I-Language
)	O
is	O
common	O
across	O
many	O
programming	O
languages	O
.	O
</s>
<s>
Although	O
the	O
syntax	O
varies	O
from	O
language	O
to	O
language	O
,	O
the	O
basic	O
structure	O
(	O
in	O
pseudocode	B-Language
form	O
)	O
looks	O
like	O
this	O
:	O
</s>
<s>
In	O
the	O
example	O
code	O
above	O
,	O
the	O
part	O
represented	O
by	O
(	O
boolean	O
condition	O
)	O
constitutes	O
a	O
conditional	B-Language
expression	O
,	O
having	O
intrinsic	O
value	O
(	O
e.g.	O
,	O
it	O
may	O
be	O
substituted	O
by	O
either	O
of	O
the	O
values	O
True	O
or	O
False	O
)	O
but	O
having	O
no	O
intrinsic	O
meaning	O
.	O
</s>
<s>
In	O
contrast	O
,	O
the	O
combination	O
of	O
this	O
expression	O
,	O
the	O
If	O
and	O
Then	O
surrounding	O
it	O
,	O
and	O
the	O
consequent	O
that	O
follows	O
afterward	O
constitute	O
a	O
conditional	B-Language
statement	O
,	O
having	O
intrinsic	O
meaning	O
(	O
e.g.	O
,	O
expressing	O
a	O
coherent	O
logical	O
rule	O
)	O
but	O
no	O
intrinsic	O
value	O
.	O
</s>
<s>
When	O
an	O
interpreter	B-Application
finds	O
an	O
If	O
,	O
it	O
expects	O
a	O
Boolean	O
condition	O
–	O
for	O
example	O
,	O
x	O
>	O
0	O
,	O
which	O
means	O
"	O
the	O
variable	O
x	O
contains	O
a	O
number	O
that	O
is	O
greater	O
than	O
zero	O
"	O
–	O
and	O
evaluates	O
that	O
condition	O
.	O
</s>
<s>
Otherwise	O
,	O
the	O
execution	O
continues	O
in	O
the	O
following	O
branch	B-General_Concept
–	O
either	O
in	O
the	O
else	O
block	O
(	O
which	O
is	O
usually	O
optional	O
)	O
,	O
or	O
if	O
there	O
is	O
no	O
else	O
branch	B-General_Concept
,	O
then	O
after	O
the	O
end	O
If	O
.	O
</s>
<s>
After	O
either	O
branch	B-General_Concept
has	O
been	O
executed	O
,	O
control	O
returns	O
to	O
the	O
point	O
after	O
the	O
end	O
If	O
.	O
</s>
<s>
In	O
early	O
programming	O
languages	O
,	O
especially	O
some	O
dialects	O
of	O
BASIC	O
in	O
the	O
1980s	O
home	O
computers	O
,	O
an	O
if	O
–	O
then	O
statement	O
could	O
only	O
contain	O
GOTO	B-Application
statements	O
(	O
equivalent	O
to	O
a	O
branch	B-General_Concept
instruction	I-General_Concept
)	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
structured	B-Language
programming	I-Language
,	O
which	O
allows	O
(	O
virtually	O
)	O
arbitrary	O
statements	O
to	O
be	O
put	O
in	O
statement	O
blocks	O
inside	O
an	O
if	O
statement	O
,	O
gained	O
in	O
popularity	O
,	O
until	O
it	O
became	O
the	O
norm	O
even	O
in	O
most	O
BASIC	O
programming	O
circles	O
.	O
</s>
<s>
Such	O
mechanisms	O
and	O
principles	O
were	O
based	O
on	O
the	O
older	O
but	O
more	O
advanced	O
ALGOL	B-Language
family	I-Language
of	O
languages	O
,	O
and	O
ALGOL-like	B-Language
languages	O
such	O
as	O
Pascal	B-Application
and	O
Modula-2	B-Language
influenced	O
modern	O
BASIC	O
variants	O
for	O
many	O
years	O
.	O
</s>
<s>
While	O
it	O
is	O
possible	O
while	O
using	O
only	O
GOTO	B-Application
statements	O
in	O
if	O
–	O
then	O
statements	O
to	O
write	O
programs	O
that	O
are	O
not	O
spaghetti	O
code	O
and	O
are	O
just	O
as	O
well	O
structured	O
and	O
readable	O
as	O
programs	O
written	O
in	O
a	O
structured	B-Language
programming	I-Language
language	O
,	O
structured	B-Language
programming	I-Language
makes	O
this	O
easier	O
and	O
enforces	O
it	O
.	O
</s>
<s>
Structured	O
if	B-Language
–	I-Language
then	I-Language
–	I-Language
else	I-Language
statements	O
like	O
the	O
example	O
above	O
are	O
one	O
of	O
the	O
key	O
elements	O
of	O
structured	B-Language
programming	I-Language
,	O
and	O
they	O
are	O
present	O
in	O
most	O
popular	O
high-level	O
programming	O
languages	O
such	O
as	O
C	B-Language
,	O
Java	B-Language
,	O
JavaScript	B-Language
and	O
Visual	B-Language
Basic	I-Language
.	O
</s>
<s>
The	O
else	O
keyword	O
is	O
made	O
to	O
target	O
a	O
specific	O
if	O
–	O
then	O
statement	O
preceding	O
it	O
,	O
but	O
for	O
nested	B-General_Concept
if	O
–	O
then	O
statements	O
,	O
classic	O
programming	O
languages	O
such	O
as	O
ALGOL	B-Language
60	I-Language
struggled	O
to	O
define	O
which	O
specific	O
statement	O
to	O
target	O
.	O
</s>
<s>
The	O
elseif	O
statement	O
,	O
in	O
the	O
Ada	B-Language
language	I-Language
for	O
example	O
,	O
is	O
simply	O
syntactic	O
sugar	O
for	O
else	O
followed	O
by	O
if	O
.	O
</s>
<s>
In	O
Ada	B-Language
,	O
the	O
difference	O
is	O
that	O
only	O
one	O
end	O
if	O
is	O
needed	O
,	O
if	O
one	O
uses	O
elseif	O
instead	O
of	O
else	O
followed	O
by	O
if	O
.	O
</s>
<s>
PHP	B-Application
uses	O
the	O
elseif	O
keyword	O
both	O
for	O
its	O
curly	O
brackets	O
or	O
colon	O
syntaxes	O
.	O
</s>
<s>
Perl	B-Language
provides	O
the	O
keyword	O
elsif	O
to	O
avoid	O
the	O
large	O
number	O
of	O
braces	O
that	O
would	O
be	O
required	O
by	O
multiple	O
if	O
and	O
else	O
statements	O
.	O
</s>
<s>
Python	B-Language
uses	O
the	O
special	O
keyword	O
elif	O
because	O
structure	O
is	O
denoted	O
by	O
indentation	O
rather	O
than	O
braces	O
,	O
so	O
a	O
repeated	O
use	O
of	O
else	O
and	O
if	O
would	O
require	O
increased	O
indentation	O
after	O
every	O
condition	O
.	O
</s>
<s>
Some	O
implementations	O
of	O
BASIC	O
,	O
such	O
as	O
Visual	B-Language
Basic	I-Language
,	O
use	O
ElseIf	O
too	O
.	O
</s>
<s>
However	O
,	O
in	O
many	O
languages	O
more	O
directly	O
descended	O
from	O
Algol	B-Language
,	O
such	O
as	O
Simula	B-Language
,	O
Pascal	B-Application
,	O
BCPL	O
and	O
C	B-Language
,	O
this	O
special	O
syntax	O
for	O
the	O
else	O
if	O
construct	O
is	O
not	O
present	O
,	O
nor	O
is	O
it	O
present	O
in	O
the	O
many	O
syntactical	O
derivatives	O
of	O
C	B-Language
,	O
such	O
as	O
Java	B-Language
,	O
ECMAScript	B-Language
,	O
and	O
so	O
on	O
.	O
</s>
<s>
This	O
works	O
because	O
in	O
these	O
languages	O
,	O
any	O
single	O
statement	O
(	O
in	O
this	O
case	O
if	O
cond	O
...	O
)	O
can	O
follow	O
a	O
conditional	B-Language
without	O
being	O
enclosed	O
in	O
a	O
block	O
.	O
</s>
<s>
Each	O
else	O
if	O
branch	B-General_Concept
effectively	O
adds	O
an	O
extra	O
nesting	B-General_Concept
level	O
.	O
</s>
<s>
If	O
all	O
terms	O
in	O
the	O
sequence	O
of	O
conditionals	B-Language
are	O
testing	O
the	O
value	O
of	O
a	O
single	O
expression	O
(	O
e.g.	O
,	O
if	O
x	O
=	O
0	O
...	O
else	O
if	O
x	O
=	O
1	O
...	O
else	O
if	O
x	O
=	O
2	O
...	O
)	O
,	O
an	O
alternative	O
is	O
the	O
switch	O
statement	O
,	O
also	O
called	O
case-statement	O
or	O
select-statement	O
.	O
</s>
<s>
ALGOL	B-Language
60	I-Language
and	O
some	O
other	O
members	O
of	O
the	O
ALGOL	B-Language
family	I-Language
allow	O
if	B-Language
–	I-Language
then	I-Language
–	I-Language
else	I-Language
as	O
an	O
expression	O
:	O
</s>
<s>
In	O
dialects	O
of	O
Lisp	B-Language
–	O
Scheme	B-Language
,	O
Racket	B-Operating_System
and	O
Common	B-Language
Lisp	I-Language
–	O
the	O
first	O
of	O
which	O
was	O
inspired	O
to	O
a	O
great	O
extent	O
by	O
ALGOL	B-Language
:	O
</s>
<s>
In	O
Haskell	B-Language
98	I-Language
,	O
there	O
is	O
only	O
an	O
if	O
expression	O
,	O
no	O
if	O
statement	O
,	O
and	O
the	O
else	O
part	O
is	O
compulsory	O
,	O
as	O
every	O
expression	O
must	O
have	O
some	O
value	O
.	O
</s>
<s>
Logic	O
that	O
would	O
be	O
expressed	O
with	O
conditionals	B-Language
in	O
other	O
languages	O
is	O
usually	O
expressed	O
with	O
pattern	B-Language
matching	I-Language
in	O
recursive	O
functions	O
.	O
</s>
<s>
Because	O
Haskell	B-Language
is	O
lazy	O
,	O
it	O
is	O
possible	O
to	O
write	O
control	O
structures	O
,	O
such	O
as	O
if	O
,	O
as	O
ordinary	O
expressions	O
;	O
the	O
lazy	O
evaluation	O
means	O
that	O
an	O
if	O
function	O
can	O
evaluate	O
only	O
the	O
condition	O
and	O
proper	O
branch	B-General_Concept
(	O
where	O
a	O
strict	O
language	O
would	O
evaluate	O
all	O
three	O
)	O
.	O
</s>
<s>
C	B-Language
and	O
C-like	O
languages	O
have	O
a	O
special	O
ternary	O
operator	O
(	O
?	O
</s>
<s>
:	O
)	O
for	O
conditional	B-Language
expressions	O
with	O
a	O
function	O
that	O
may	O
be	O
described	O
by	O
a	O
template	O
like	O
this	O
:	O
</s>
<s>
This	O
means	O
that	O
it	O
can	O
be	O
inlined	O
into	O
expressions	O
,	O
unlike	O
if-statements	O
,	O
in	O
C-like	O
languages	O
:	O
</s>
<s>
which	O
can	O
be	O
compared	O
to	O
the	O
Algol-family	O
if	B-Language
–	I-Language
then	I-Language
–	I-Language
else	I-Language
expressions	O
(	O
in	O
contrast	O
to	O
a	O
statement	O
)	O
(	O
and	O
similar	O
in	O
Ruby	B-Language
and	O
Scala	B-Application
,	O
among	O
others	O
)	O
.	O
</s>
<s>
In	O
Visual	B-Language
Basic	I-Language
and	O
some	O
other	O
languages	O
,	O
a	O
function	O
called	O
IIf	B-Language
is	O
provided	O
,	O
which	O
can	O
be	O
used	O
as	O
a	O
conditional	B-Language
expression	O
.	O
</s>
<s>
However	O
,	O
it	O
does	O
not	O
behave	O
like	O
a	O
true	O
conditional	B-Language
expression	O
,	O
because	O
both	O
the	O
true	O
and	O
false	O
branches	O
are	O
always	O
evaluated	O
;	O
it	O
is	O
just	O
that	O
the	O
result	O
of	O
one	O
of	O
them	O
is	O
thrown	O
away	O
,	O
while	O
the	O
result	O
of	O
the	O
other	O
is	O
returned	O
by	O
the	O
IIf	B-Language
function	O
.	O
</s>
<s>
In	O
Tcl	B-Operating_System
if	O
is	O
not	O
a	O
keyword	O
but	O
a	O
function	O
(	O
in	O
Tcl	B-Operating_System
known	O
as	O
command	O
or	O
proc	O
)	O
.	O
</s>
<s>
invokes	O
a	O
function	O
named	O
if	O
passing	O
2	O
arguments	O
:	O
The	O
first	O
one	O
being	O
the	O
condition	O
and	O
the	O
second	O
one	O
being	O
the	O
true	O
branch	B-General_Concept
.	O
</s>
<s>
Both	O
arguments	O
are	O
passed	O
as	O
strings	O
(	O
in	O
Tcl	B-Operating_System
everything	O
within	O
curly	O
brackets	O
is	O
a	O
string	O
)	O
.	O
</s>
<s>
Uplevel	O
makes	O
it	O
possible	O
to	O
implement	O
new	O
control	O
constructs	O
as	O
Tcl	B-Operating_System
procedures	O
(	O
for	O
example	O
,	O
uplevel	O
could	O
be	O
used	O
to	O
implement	O
the	O
while	O
construct	O
as	O
a	O
Tcl	B-Operating_System
procedure	O
)	O
.	O
</s>
<s>
In	O
Rust	B-Application
,	O
if	O
is	O
always	O
an	O
expression	O
.	O
</s>
<s>
It	O
evaluates	O
to	O
the	O
value	O
of	O
whichever	O
branch	B-General_Concept
is	O
executed	O
,	O
or	O
to	O
the	O
unit	O
type	O
(	O
)	O
if	O
no	O
branch	B-General_Concept
is	O
executed	O
.	O
</s>
<s>
If	O
a	O
branch	B-General_Concept
does	O
not	O
provide	O
a	O
return	O
value	O
,	O
it	O
evaluates	O
to	O
(	O
)	O
by	O
default	O
.	O
</s>
<s>
To	O
ensure	O
the	O
if	O
expression	O
's	O
type	O
is	O
known	O
at	O
compile	O
time	O
,	O
each	O
branch	B-General_Concept
must	O
evaluate	O
to	O
a	O
value	O
of	O
the	O
same	O
type	O
.	O
</s>
<s>
For	O
this	O
reason	O
,	O
an	O
else	O
branch	B-General_Concept
is	O
effectively	O
compulsory	O
unless	O
the	O
other	O
branches	O
evaluate	O
to	O
(	O
)	O
,	O
because	O
an	O
if	O
without	O
an	O
else	O
can	O
always	O
evaluate	O
to	O
(	O
)	O
by	O
default	O
.	O
</s>
<s>
Up	O
to	O
Fortran	O
77	O
,	O
the	O
language	O
Fortran	O
has	O
an	O
"	O
arithmetic	B-Language
if	I-Language
"	O
statement	O
which	O
is	O
halfway	O
between	O
a	O
computed	O
IF	O
and	O
a	O
case	O
statement	O
,	O
based	O
on	O
the	O
trichotomy	O
This	O
was	O
the	O
earliest	O
conditional	B-Language
statement	O
in	O
Fortran	O
:	O
</s>
<s>
Because	O
this	O
arithmetic	B-Language
IF	I-Language
is	O
equivalent	O
to	O
multiple	O
GOTO	B-Application
statements	O
that	O
could	O
jump	O
to	O
anywhere	O
,	O
it	O
is	O
considered	O
to	O
be	O
an	O
unstructured	O
control	O
statement	O
,	O
and	O
should	O
not	O
be	O
used	O
if	O
more	O
structured	O
statements	O
can	O
be	O
used	O
.	O
</s>
<s>
In	O
practice	O
it	O
has	O
been	O
observed	O
that	O
most	O
arithmetic	B-Language
IF	I-Language
statements	O
referenced	O
the	O
following	O
statement	O
with	O
one	O
or	O
two	O
of	O
the	O
labels	O
.	O
</s>
<s>
This	O
was	O
the	O
only	O
conditional	B-Language
control	O
statement	O
in	O
the	O
original	O
implementation	O
of	O
Fortran	O
on	O
the	O
IBM	B-Device
704	I-Device
computer	O
.	O
</s>
<s>
On	O
that	O
computer	O
the	O
test-and-branch	O
op-code	O
had	O
three	O
addresses	O
for	O
those	O
three	O
states	O
.	O
</s>
<s>
Other	O
computers	O
would	O
have	O
"	O
flag	O
"	O
registers	O
such	O
as	O
positive	O
,	O
zero	O
,	O
negative	O
,	O
even	O
,	O
overflow	O
,	O
carry	O
,	O
associated	O
with	O
the	O
last	O
arithmetic	O
operations	O
and	O
would	O
use	O
instructions	O
such	O
as	O
'	O
Branch	B-General_Concept
if	O
accumulator	O
negative	O
 '	O
then	O
'	O
Branch	B-General_Concept
if	O
accumulator	O
zero	O
 '	O
or	O
similar	O
.	O
</s>
<s>
In	O
contrast	O
to	O
other	O
languages	O
,	O
in	O
Smalltalk	B-Application
the	O
conditional	B-Language
statement	O
is	O
not	O
a	O
language	B-Language
construct	I-Language
but	O
defined	O
in	O
the	O
class	O
Boolean	O
as	O
an	O
abstract	O
method	O
that	O
takes	O
two	O
parameters	O
,	O
both	O
closures	B-Language
.	O
</s>
<s>
Boolean	O
has	O
two	O
subclasses	O
,	O
True	O
and	O
False	O
,	O
which	O
both	O
define	O
the	O
method	O
,	O
True	O
executing	O
the	O
first	O
closure	B-Language
only	O
,	O
False	O
executing	O
the	O
second	O
closure	B-Language
only	O
.	O
</s>
<s>
JavaScript	B-Language
uses	O
if-else	B-Language
statements	O
similar	O
to	O
those	O
in	O
C	B-Language
languages	I-Language
.	O
</s>
<s>
The	O
above	O
example	O
takes	O
the	O
conditional	B-Language
of	O
Math.random( )	O
<	O
0.5	O
which	O
outputs	O
true	O
if	O
a	O
random	O
float	O
value	O
between	O
0	O
and	O
1	O
is	O
greater	O
than	O
0.5	O
.	O
</s>
<s>
In	O
Lambda	B-Language
calculus	I-Language
,	O
the	O
concept	O
of	O
an	O
if-then-else	B-Language
conditional	B-Language
can	O
be	O
expressed	O
using	O
the	O
following	O
expressions	O
:	O
</s>
<s>
true	O
=	O
λx	B-Language
.	O
</s>
<s>
λy	B-Language
.	O
</s>
<s>
false	O
=	O
λx	B-Language
.	O
</s>
<s>
λy	B-Language
.	O
</s>
<s>
ifThenElse	O
=	O
( λc	O
.	O
</s>
<s>
λx	B-Language
.	O
</s>
<s>
λy	B-Language
.	O
</s>
<s>
true	O
takes	O
up	O
to	O
two	O
arguments	O
and	O
once	O
both	O
are	O
provided	O
(	O
see	O
currying	B-Application
)	O
,	O
it	O
returns	O
the	O
first	O
argument	O
given	O
.	O
</s>
<s>
false	O
takes	O
up	O
to	O
two	O
arguments	O
and	O
once	O
both	O
are	O
provided(see currying )	O
,	O
it	O
returns	O
the	O
second	O
argument	O
given	O
.	O
</s>
<s>
note	O
:	O
if	O
ifThenElse	O
is	O
passed	O
two	O
functions	O
as	O
the	O
left	O
and	O
right	O
conditionals	B-Language
;	O
it	O
is	O
necessary	O
to	O
also	O
pass	O
an	O
empty	O
tuple	O
(	O
)	O
to	O
the	O
result	O
of	O
ifThenElse	O
in	O
order	O
to	O
actually	O
call	O
the	O
chosen	O
function	O
,	O
otherwise	O
ifThenElse	O
will	O
just	O
return	O
the	O
function	O
object	O
without	O
getting	O
called	O
.	O
</s>
<s>
In	O
a	O
system	O
where	O
numbers	O
can	O
be	O
used	O
without	O
definition	O
(	O
like	O
Lisp	B-Language
,	O
Traditional	O
paper	O
math	O
,	O
so	O
on	O
)	O
,	O
the	O
above	O
can	O
be	O
expressed	O
as	O
a	O
single	O
closure	B-Language
below	O
:	O
</s>
<s>
A	O
working	O
JavaScript	B-Language
analogy(using only functions of single variable for rigor )	O
to	O
this	O
is	O
as	O
follows	O
:	O
</s>
<s>
The	O
first	O
example	O
shows	O
the	O
first	O
branch	B-General_Concept
being	O
taken	O
,	O
while	O
second	O
example	O
shows	O
the	O
second	O
branch	B-General_Concept
being	O
taken	O
.	O
</s>
<s>
Smalltalk	B-Application
uses	O
a	O
similar	O
idea	O
for	O
its	O
true	O
and	O
false	O
representations	O
,	O
with	O
True	O
and	O
False	O
being	O
singleton	O
objects	O
that	O
respond	O
to	O
messages	O
ifTrue/ifFalse	O
differently	O
.	O
</s>
<s>
either	O
wrapped	O
in	O
another	O
function	O
or	O
re-implemented	O
as	O
shown	O
in	O
The	O
Haskell	B-Language
section	O
of	O
this	O
page	O
.	O
</s>
<s>
Switch	O
statements	O
can	O
allow	O
compiler	B-Application
optimizations	I-Application
,	O
such	O
as	O
lookup	B-Data_Structure
tables	I-Data_Structure
.	O
</s>
<s>
In	O
dynamic	O
languages	O
,	O
the	O
cases	O
may	O
not	O
be	O
limited	O
to	O
constant	O
expressions	O
,	O
and	O
might	O
extend	O
to	O
pattern	B-Language
matching	I-Language
,	O
as	O
in	O
the	O
shell	B-Language
script	I-Language
example	O
on	O
the	O
right	O
,	O
where	O
the	O
'	O
*	O
)	O
'	O
implements	O
the	O
default	O
case	O
as	O
a	O
regular	B-Language
expression	I-Language
matching	O
any	O
string	O
.	O
</s>
<s>
Pattern	B-Language
matching	I-Language
may	O
be	O
seen	O
as	O
an	O
alternative	O
to	O
both	O
if	B-Language
–	I-Language
then	I-Language
–	I-Language
else	I-Language
,	O
and	O
case	O
statements	O
.	O
</s>
<s>
It	O
is	O
available	O
in	O
many	O
programming	O
languages	O
with	O
functional	B-Language
programming	I-Language
features	O
,	O
such	O
as	O
Wolfram	B-Language
Language	I-Language
,	O
ML	B-Language
and	O
many	O
others	O
.	O
</s>
<s>
Here	O
is	O
a	O
simple	O
example	O
written	O
in	O
the	O
OCaml	B-Language
language	O
:	O
</s>
<s>
The	O
power	O
of	O
pattern	B-Language
matching	I-Language
is	O
the	O
ability	O
to	O
concisely	O
match	O
not	O
only	O
actions	O
but	O
also	O
values	O
to	O
patterns	O
of	O
data	O
.	O
</s>
<s>
Here	O
is	O
an	O
example	O
written	O
in	O
Haskell	B-Language
which	O
illustrates	O
both	O
of	O
these	O
features	O
:	O
</s>
<s>
Pattern	B-Language
matching	I-Language
is	O
not	O
strictly	O
speaking	O
always	O
a	O
choice	O
construct	O
,	O
because	O
it	O
is	O
possible	O
in	O
Haskell	B-Language
to	O
write	O
only	O
one	O
alternative	O
,	O
which	O
is	O
guaranteed	O
to	O
always	O
be	O
matched	O
–	O
in	O
this	O
situation	O
,	O
it	O
is	O
not	O
being	O
used	O
as	O
a	O
choice	O
construct	O
,	O
but	O
simply	O
as	O
a	O
way	O
to	O
bind	O
names	O
to	O
values	O
.	O
</s>
<s>
In	O
programming	O
languages	O
that	O
have	O
associative	B-Application
arrays	I-Application
or	O
comparable	O
data	O
structures	O
,	O
such	O
as	O
Python	B-Language
,	O
Perl	B-Language
,	O
PHP	B-Application
or	O
Objective-C	B-Language
,	O
it	O
is	O
idiomatic	O
to	O
use	O
them	O
to	O
implement	O
conditional	B-Language
assignment	O
.	O
</s>
<s>
In	O
languages	O
that	O
have	O
anonymous	B-General_Concept
functions	I-General_Concept
or	O
that	O
allow	O
a	O
programmer	O
to	O
assign	O
a	O
named	O
function	O
to	O
a	O
variable	O
reference	O
,	O
conditional	B-Language
flow	O
can	O
be	O
implemented	O
by	O
using	O
a	O
hash	O
as	O
a	O
dispatch	O
table	O
.	O
</s>
<s>
An	O
alternative	O
to	O
conditional	B-General_Concept
branch	I-General_Concept
instructions	O
is	O
predication	B-General_Concept
.	O
</s>
<s>
Predication	B-General_Concept
is	O
an	O
architectural	B-General_Concept
feature	O
that	O
enables	O
instructions	O
to	O
be	O
conditionally	O
executed	O
instead	O
of	O
modifying	O
the	O
control	O
flow	O
.	O
</s>
<s>
Programming	O
language	O
Structured	O
if	O
switch	O
–	O
select	O
–	O
case	O
Arithmetic	B-Language
if	I-Language
Pattern	B-Language
matching	I-Language
then	O
else	O
else	O
–	O
if	O
Ada	B-Language
APL	B-Language
Bash	B-Operating_System
shell	I-Operating_System
C	B-Language
,	O
C++	B-Language
C#	B-Application
COBOL	B-Application
Eiffel	B-Language
F#	B-Operating_System
Fortran	O
90	O
Go	B-Application
Haskell	B-Language
Java	B-Language
Java.sun.com,	O
Java	B-Language
Language	I-Language
Specification	I-Language
,	O
3rd	O
Edition	O
.	O
</s>
<s>
ECMAScript	B-Language
(	O
JavaScript	B-Language
)	O
Ecma-international.org	O
ECMAScript	B-Language
Language	O
Specification	O
,	O
5th	O
Edition	O
.	O
</s>
