<s>
In	O
computing	O
,	O
IIf	B-Language
(	O
an	O
abbreviation	O
for	O
Immediate	O
if	B-Language
)	O
is	O
a	O
function	O
in	O
several	O
editions	O
of	O
the	O
Visual	B-Language
Basic	I-Language
programming	O
language	O
and	O
ColdFusion	B-Language
Markup	I-Language
Language	I-Language
(	O
CFML	B-Language
)	O
,	O
and	O
on	O
spreadsheets	B-Application
that	O
returns	O
the	O
second	O
or	O
third	O
parameter	O
based	O
on	O
the	O
evaluation	O
of	O
the	O
first	O
parameter	O
.	O
</s>
<s>
It	O
is	O
an	O
example	O
of	O
a	O
conditional	B-Language
expression	O
,	O
which	O
is	O
similar	O
to	O
a	O
conditional	B-Language
statement	I-Language
.	O
</s>
<s>
The	O
syntax	O
of	O
the	O
IIf	B-Language
function	O
is	O
as	O
follows	O
:	O
</s>
<s>
truepart	O
defines	O
what	O
the	O
IIf	B-Language
function	O
returns	O
if	B-Language
the	O
evaluation	O
of	O
expr	O
returns	O
true	O
.	O
</s>
<s>
falsepart	O
defines	O
what	O
the	O
IIf	B-Language
function	O
returns	O
if	B-Language
the	O
evaluation	O
of	O
expr	O
returns	O
false	O
.	O
</s>
<s>
Many	O
languages	O
have	O
an	O
operator	O
to	O
accomplish	O
the	O
same	O
purpose	O
,	O
generally	O
referred	O
to	O
as	O
a	O
conditional	B-Language
operator	O
(	O
or	O
,	O
less	O
precisely	O
,	O
as	O
a	O
ternary	O
operator	O
)	O
;	O
the	O
best	O
known	O
is	O
?	O
</s>
<s>
:	O
,	O
as	O
used	O
in	O
C	B-Language
,	O
C++	O
,	O
and	O
related	O
languages	O
.	O
</s>
<s>
Some	O
of	O
the	O
problems	O
with	O
the	O
IIf	B-Language
function	O
,	O
as	O
discussed	O
later	O
,	O
do	O
not	O
exist	O
with	O
a	O
conditional	B-Language
operator	O
,	O
because	O
the	O
language	O
is	O
free	O
to	O
examine	O
the	O
type	O
and	O
delay	O
evaluation	O
of	O
the	O
operands	O
,	O
as	O
opposed	O
to	O
simply	O
passing	O
them	O
to	O
a	O
library	O
function	O
.	O
</s>
<s>
Because	O
IIf	B-Language
is	O
a	O
library	O
function	O
,	O
it	O
will	O
always	O
require	O
the	O
overhead	O
of	O
a	O
function	O
call	O
,	O
whereas	O
a	O
conditional	B-Language
operator	O
will	O
more	O
likely	O
produce	O
inline	O
code	O
.	O
</s>
<s>
If	B-Language
the	O
function	O
is	O
called	O
with	O
arguments	O
of	O
other	O
types	O
(	O
variables	O
or	O
literals	O
)	O
,	O
there	O
will	O
be	O
additional	O
overhead	O
to	O
convert	O
these	O
to	O
Variant	O
.	O
</s>
<s>
There	O
may	O
also	O
be	O
additional	O
overhead	O
to	O
check	O
the	O
argument	O
types	O
and	O
convert	O
one	O
of	O
them	O
if	B-Language
they	O
do	O
not	O
have	O
the	O
same	O
type	O
.	O
</s>
<s>
Another	O
issue	O
with	O
IIf	B-Language
arises	O
because	O
it	O
is	O
a	O
library	O
function	O
:	O
unlike	O
the	O
C-derived	O
conditional	B-Language
operator	O
,	O
both	O
truepart	O
and	O
the	O
falsepart	O
will	O
be	O
evaluated	O
regardless	O
of	O
which	O
one	O
is	O
actually	O
returned	O
.	O
</s>
<s>
although	O
TrueFunction	O
is	O
the	O
function	O
intended	O
to	O
be	O
called	O
,	O
IIf	B-Language
will	O
call	O
both	O
TrueFunction	O
and	O
FalseFunction	O
.	O
</s>
<s>
This	O
issue	O
makes	O
the	O
IIf( )	O
call	O
less	O
useful	O
than	O
the	O
conditional	B-Language
operator	O
.	O
</s>
<s>
To	O
solve	O
this	O
issue	O
,	O
Microsoft	O
developers	O
had	O
considered	O
converting	O
IIf	B-Language
to	O
an	O
intrinsic	O
function	O
;	O
had	O
this	O
happened	O
,	O
the	O
compiler	O
would	O
have	O
been	O
able	O
to	O
perform	O
type	O
inference	O
and	O
short-circuiting	O
by	O
replacing	O
the	O
function	O
call	O
with	O
inline	O
code	O
.	O
</s>
<s>
In	O
Visual	B-Language
Basic	I-Language
,	O
IIf	B-Language
is	O
not	O
the	O
sole	O
way	O
to	O
evaluate	O
and	O
perform	O
actions	O
based	O
on	O
whether	O
an	O
expression	O
is	O
true	O
or	O
false	O
.	O
</s>
<s>
The	O
following	O
example	O
uses	O
IIf	B-Language
:	O
</s>
<s>
It	O
could	O
also	O
be	O
written	O
in	O
the	O
following	O
way	O
,	O
using	O
standard	O
conditionals	B-Language
:	O
</s>
<s>
The	O
above	O
example	O
would	O
also	O
eliminate	O
the	O
problem	O
of	O
IIf	B-Language
evaluating	O
both	O
its	O
truepart	O
and	O
falsepart	O
parameters	O
.	O
</s>
<s>
Visual	B-Language
Basic	I-Language
2008	O
(	O
VB	O
9.0	O
)	O
introduced	O
a	O
true	O
conditional	B-Language
operator	O
,	O
called	O
simply	O
"	O
If	B-Language
"	O
,	O
which	O
also	O
eliminates	O
this	O
problem	O
.	O
</s>
<s>
Its	O
syntax	O
is	O
similar	O
to	O
the	O
IIf	B-Language
function	O
's	O
syntax	O
:	O
</s>
<s>
$	O
iif( )	O
is	O
present	O
in	O
mIRC	B-Language
script	I-Language
,	O
with	O
similar	O
syntax	O
.	O
</s>
<s>
Calling	O
/testiif	O
will	O
print	O
out	O
"	O
testing	O
$iif	O
:	O
1	O
execution(s )	O
"	O
.	O
</s>
<s>
mIRC	B-Language
's	O
$iif	O
acts	O
more	O
like	O
C	B-Language
's	O
?	O
</s>
<s>
:	O
than	O
IIf( )	O
in	O
VB	O
since	O
it	O
wo	O
n't	O
pre-evaluate	O
both	O
.	O
</s>
<s>
IIF( )	O
is	O
a	O
function	O
in	O
dBase	B-Application
and	O
xBase	B-Language
(	O
1992	O
and	O
older	O
)	O
.	O
</s>
<s>
iif( )	O
is	O
also	O
a	O
compiler	O
magic	O
function	O
of	O
Oxygene	B-Language
.	O
</s>
<s>
It	O
is	O
not	O
a	O
real	O
function	O
and	O
is	O
at	O
compile	O
time	O
unrolled	O
to	O
conditional	B-Language
statements	O
.	O
</s>
<s>
In	O
this	O
example	O
a	O
new	O
strong	O
type	O
string	O
named	O
"	O
someString	O
"	O
is	O
created	O
(	O
using	O
Type	O
inference	O
)	O
and	O
the	O
iif	B-Language
function	O
will	O
fill	O
it	O
depending	O
on	O
the	O
outcome	O
of	O
the	O
boolean	O
expression	O
.	O
</s>
<s>
SQL	B-Application
Server	I-Application
2012	O
and	O
newer	O
implements	O
the	O
IIF( )	O
function	O
(	O
Transact-SQL	B-Language
)	O
:	O
</s>
<s>
IIf	B-Language
in	O
C	B-Language
is	O
the	O
?	O
</s>
<s>
:	O
conditional	B-Language
operator	O
:	O
</s>
<s>
IIf	B-Language
in	O
Python	B-Language
:	O
</s>
<s>
IIf	B-Language
(	O
either	O
)	O
in	O
Red	B-Language
and	O
Rebol	B-Application
:	O
</s>
