# Is every continuous, real valued function on a compact metric space bounded?

The converse statement, "A metric space on which every continuous, real valued function is bounded is compact" is dealt with on this site, as it is in Greene and Gamelin's monograph, "Introduction to Topology", where a hint to its proof is offered. I see no discussion of the direct statement in my title. Is it true? If so, can someone outline a proof?

Yes, it is bounded. Suppose it is not bounded , for every integer $n$, you have $x_n$ such that $|f(x_n)|\geq n$, you can extract a subsequence $x_{n_i}$ which converges towards $x$ since the domain is compact, this implies that $f(x_{n_i})$ converges towards $f(x)$ since $f$ is continuous, contradiction since $|f(x_{n_i})|\geq n_i$.
If $f$ is continuous on $X$ to $\mathbb{R}$. Then define $U_n = f^{-1}[(-n,n)]$ for $n \in \mathbb{N}^+$, the the $U_n$ are open by continuity and $U_k \subseteq U_l$ wheneven $k \le l$, i.e. the family is increasing. Also, $\mathcal{U} = \{U_n: n \in \mathbb{N}^+ \}$ is an open cover of $X$, as every $y$ is in some $(-n,n)$.
If $X$ is compact, this has a finite subcover. If $U_N$is the element with the largest index, then $X \subseteq U_N$ and so $f[X] \subseteq [-N,N]$, so $f$ is bounded.