Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
Documentation Center
Search

If

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

If evaluates only the argument determined by the value of the condition.
If[condition, t, f] is left unevaluated if condition evaluates to neither True nor False.
If[condition, t] gives Null if condition evaluates to False.
• See also:
Which, While.

Examples

Using InstantCalculators

Here are the InstantCalculators for the If function. Enter the parameters for your calculation and click Calculate to see the result.

Entering Commands Directly

You can paste a template for this command via the Text Input button on the If Function Controller.

The test gives False, so y is returned.

The test gives neither True nor False, so neither branch is evaluated.

If there is a fourth argument to If, it is used when the test does not yield True or False.


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: