I'm helping an acquaintance to prove this statement, but I'm having doubts if the proof I did is correct. Can someone help me and tell me if this is correct?
I'm in doubt on ($\Leftarrow$).
$\Rightarrow$ Suppose f continuous. Let $X \subset \mathbb{R}$ and $a \in \overline{X}$. Because $f$ is continuous, given $\varepsilon > 0$, exists $\delta > 0$ such that
$$\mid z - a \mid \ < \ \delta \ \Rightarrow \ \mid f(z) - f(a) \mid \ < \ \varepsilon.$$
How $a \in \overline{X}$, we have that
$$[(a - \delta, a + \delta) - \{a\} ]\cap X \ne \emptyset. $$
Then there exists $x \in X$ such that
$$\mid x - a \mid \ < \ \delta \ \Rightarrow \ \mid f(x) - f(a) \mid \ < \ \varepsilon$$
$$\Leftrightarrow f(x) \in (f(a) - \varepsilon, f(a) + \varepsilon). $$
How $\varepsilon$ is arbitrary, we have that $f(a) \in \overline{f(X)}$.
$\Leftarrow$ Suppose that $f$ is discontinuous in a point $a \in \mathbb{R}$. Then there exists $\varepsilon > 0$ such that for every $\delta > 0$, we have that
$$\mid z - a \mid \ < \ \delta \ \Rightarrow \ \mid f(z) - f(a) \mid \ \geq \ \varepsilon.$$
Given $X \subset \mathbb{R}$ and $a \in \overline{X}$, we have that $f(a) \in \overline{f(X)}$. Therefore
$$[(f(a) - \varepsilon, f(a) + \varepsilon) - \{a\}] \cap f(X) \ne \emptyset.$$
Then exists $x \in X - \{a\}$ such that
$$\mid x - a \mid \ < \ \delta \ \Rightarrow \ \mid f(x) - f(a) \mid \ < \ \varepsilon,$$
what is a contradiction.
I don't know if my loop is correct as I take a set X where a is an accumulation point. In the book in which I study and the solutions to the questions I see, this is not used.