Continuity

Discuss the continuity of the function $f\left(x\right)= \begin{cases} \dfrac{x-\left|x\right|}{x}, & x \neq 0 \\ 2, & x=0 \end{cases}$ $\;$ at $x=0$


When $x>0, \; \left|x\right|=+x$

When $x<0, \; \left|x\right|=-x$

$\lim\limits_{x \to 0^+}f\left(x\right)=\lim\limits_{x \to 0} \; \dfrac{x-x}{x}=0$

$\lim\limits_{x \to 0^-}f\left(x\right)=\lim\limits_{x \to 0} \; \dfrac{x+x}{x}=\dfrac{2x}{x}=2$

$f\left(0\right)=2$

Since $\lim\limits_{x \to 0^-}f\left(x\right)=f\left(0\right) \neq \lim\limits_{x \to 0^+}f\left(x\right)$, function $f\left(x\right)$ is discontinuous at $x=0$.