Restrictions and Conditionals
Desmos uses braces {} for domain and range restrictions as well as simple conditional expressions.
Restrictions
Append a condition in braces to an expression. Restrictions also work with implicit equations and inequalities.
1
2
3
Loading graph…
Multiple conditions
Comma-separated conditions inside one pair of braces behave like “or.” Separate pairs of braces behave like “and.”
1
2
Loading graph…
and or
In the past, creating complex conditions required workarounds using and , but now you can use and directly.
1
2
Loading graph…
Conditional expressions
Use {condition 1: value 1, condition 2: value 2, …} to switch values according to conditions.
1
2
3
Loading graph…
You can also nest {} like this:
1
How braces work
{condition 1: value 1, condition 2: value 2, …} works in this order:
- Evaluate the conditions from left to right and return the value for the first condition that is true.
- If the value for a condition is omitted, return .
- If no condition is true, do not graph or evaluate the entire expression containing the braces.
Therefore,
1
graphs only when . Likewise,
1
graphs only when both and .