Monotone continuous function Could some one please to verify if this converse statement is true?

The original statement: "Suppose $\,f: D \rightarrow R$ is monotone. If $\,f(D)$ is an interval then $\,f$ is continuous". Which is proved in the text book.

The converse statement: "Suppose $\,f: D \rightarrow R$ is monotone. If $\,f$ is continuous then $\,f(D)$ is an interval"
If $D$ itself is an interval, this is true (even without requiring monotonicity of $f$): If $a&lt;b&lt;c$ and $a, c\in f(D)$, then by the intermediate value theorem, you also have $b\in f(D)$.

If $D$ is any subset of the real numbers, this is wrong in general: $f: [0, 1]\cup [2,3] \rightarrow \mathbb{R}, x \mapsto x$ is obviously strictly monotone and continuous, but $f(D)=[0,1]\cup [2,3]$ is not an interval.
If $D$ itself is an interval, this is true (even without requiring monotonicity of $f$): If $a&lt;b&lt;c$ and $a, c\in f(D)$, then by the intermediate value theorem, you also have $b\in f(D)$.

If $D$ is any subset of the real numbers, this is wrong in general: $f: [0, 1]\cup [2,3] \rightarrow \mathbb{R}, x \mapsto x$ is obviously strictly monotone and continuous, but $f(D)=[0,1]\cup [2,3]$ is not an interval.