Let $X$ be a connected metric space and $D$ a set. Let $f: X \to D$ such that for every $x \in X$ there is a neighborhood in which $f$ is constant. Show that $f$ is constant.
I'm trying to get the hang of the problem, but this seems somewhat self explanatory? Perhaps I'm not understanding it correctly. If we have that $\forall x \in X:$ $\exists V_\varepsilon(x)$ such that $f$ is constant then wouldn't it imply that it must be constant all in all? The open sets acts as covers for $X$ and since $X$ is connected they cover whole $X$ right?