If statements in equations?

When creating an equation is there any way to let someone know that if this number doesn't fit into this then use this other equation? Ex: $x>1$ then use $x+y$, or if $x<1$ then use $x-y$. Or do you just have to find an equation that works for both probability?

• here is another example, this is an equation i created to find how many square in the square aren't touching other squares Example: 2*2*2 square only has 4 sqaures that have two sides not touching another block and 8 squares that have 3 sides not touching a block. Equation: for 0sides
– Matt Kemp
Sep 25, 2014 at 22:18

$$f(x,y)=\begin{cases} x+y & X>1 \\ x-y & X<1 \end{cases}$$
$f(x,y) =\,$ for $x>1\,$ use $x+y\,$ and for $x<1\,$ use $x-y$
You could also say $f(x,y) = x + \frac{x-1}{|x-1|}y$ for your particular example.