Consider the following function defined in parts:
$$ f(x)=\Bigg\lbrace \begin{eqnarray} x+2 & \mbox{si} & x\leq 0 \\\\ 2 & \mbox{si} & 0 < x \leq 2 \\\\ x+4 & \mbox{si} & x>2 \end{eqnarray}$$
Do the graphic representation. Find the domain and the image of the function.
Development:
A way of proceeding is to draw the graph of the function and then find the domain and the image.
We may realize that:

In the interval $$(\infty, 0]$$ we have a straight line of slope $$m = 1$$ and that cuts the axis $$x$$ in $$x =2$$.

In the interval $$(0, 2]$$, we have a constant function $$y = 2$$.
 In the interval $$(2, +\infty)$$ we have a straight line of slope $$m =1$$ and that cuts the axis $$x$$ in $$x = 4$$.
Therefore the graph of the function is:
Thus it is clear that the domain of the function is:
$$Dom (f) = (\infty, +\infty)$$
and that its image is:
$$Im (f) = (\infty, 2]$$
Solution:
$$Dom (f) = (\infty, +\infty)$$
$$Im (f) = (\infty, 2]$$