This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Built-in Functions / Programming / Flow Control /

If

FilledSmallSquare If[condition, t, f] gives t if condition evaluates to True, and f if it evaluates to False.

FilledSmallSquare If[condition, t, f, u] gives u if condition evaluates to neither True nor False.

FilledSmallSquare If evaluates only the argument determined by the value of the condition.

FilledSmallSquare If[condition, t, f] is left unevaluated if condition evaluates to neither True nor False.

FilledSmallSquare If[condition, t] gives Null if condition evaluates to False.

FilledSmallSquare See Section 1.5.6 and Section 2.6.8.

FilledSmallSquare See also: Switch, Which, Condition, DiracDelta.

FilledSmallSquare New in Version 1.

Further Examples