Answer
$f(x)=\left\{\begin{array}{l}
2~~~~~~\ \mathrm{i}\mathrm{f}~\ x\leq 0\\
-1~~~\ \mathrm{i}\mathrm{f}~~\mathrm{x}\ \gt 1
\end{array}\right.$
Domain: $(-\infty,\ 0]\ \cup(1,\ \infty)$
Range: $\{-1,2\}$
Work Step by Step
We see that the graph consists of two horizontal lines, $y=2$ and $y=-1$. Solid circles indicate that the value belongs to that piece of the function (e.g. "$\leq$" or "$\geq$"), while open circles indicate that the value does not (e.g. "$\lt$" or "$\gt$"). Thus we have:
$f(x)=\left\{\begin{array}{l}
2~~~~~~\ \mathrm{i}\mathrm{f}~\ x\leq 0\\
-1~~~\ \mathrm{i}\mathrm{f}~~\mathrm{x}\ \gt 1
\end{array}\right.$
We see that the domain is all real numbers, except for the region between 0 and 1 (0 is included, while 1 is excluded). The range is either -1 or 2:
Domain: $(-\infty,\ 0]\ \cup(1,\ \infty)$
Range: $\{-1,2\}$