I came across the following function $$f(x) = \begin{cases} x, & x \in \mathbb{Q}, \\ -x, & x \in \mathbb{R} \backslash \mathbb{Q}. \end{cases}$$ It is claimed that $f(x)$ is continuous at zero. I want to be able to prove this.
So let $\varepsilon >0$ and consider that \begin{eqnarray*} \left| f(x) - f(0) \right| &=& \left| f(x) -0 \right| = \left| f(x) \right|. \end{eqnarray*} Now at any $x \in \mathbb{R}$, there exists a rational number $q$ such that $\left| x - q \right| < \frac{\varepsilon}{2}$ and similarly for an irrational number. I assume this is how the proof is formulated, but can't seem to structure it.
Fix $\epsilon>0$. Taking $\delta=\epsilon$ we have $$ |x|<\delta\implies |f(x)-f(0)|=|x|<\epsilon $$