Answer
$f(x)=\left\{\begin{array}{l}
x~~~\ \mathrm{i}\mathrm{f}~~\ x\leq 0\\
2~~~\ \mathrm{i}\mathrm{f}~~\ x\gt 0
\end{array}\right.$
Domain: $(-\infty,\ \infty)$
Range: $(-\infty,0$] $\cup\{2\}$
Work Step by Step
We see that the graph consists of the line $y=1$ from $-\infty$ to 0 and the horizontal line $y=2$ after. 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}
x~~~\ \mathrm{i}\mathrm{f}~~\ x\leq 0\\
2~~~\ \mathrm{i}\mathrm{f}~~\ x\gt 0
\end{array}\right.$
We see that the domain is all real numbers, while the range consists of all negative numbers, including 0 and 2:
Domain: $(-\infty,\ \infty)$
Range: $(-\infty,0$] $\cup\{2\}$