Skip to main content
2 of 5
added 12 characters in body
Tomasz Kania
  • 11.3k
  • 2
  • 39
  • 75

Yes, even more is true. The argument is as follows. Let $f\colon X \to \mathbb R$ be a continuous function and let $K\subset X$ be a compact. Then $f|_K$ is uniformly continuous, let $\omega$ be its nondecreasing subadditive modulus of continuity. By McShane-Whitney's extension formula $f|_K$ admits an uniformly continuous extension to $X$ with the same modulus, more concretely $F(x)=\inf\{f(k)+\omega(d(k,x))\colon k\in K\}$ is this extension which is uniformly continuous on the whole $X$.