Let $(X,d)$ be a metric space, let $f:X\rightarrow \mathbb{R}$, and let $a\in X$. Define the oscillation of $f$ at $a$ by $$\text{osc}(f,a) = \inf_{r>0}(\sup \{|f(x) - f(y)| : x,y \in B_r(a)\}).$$
(Note: $B_r(a) = \{x: |x - a| < r\}).$
Prove that $f$ is continuous if and only if $\text{osc}(f,a) = 0$
I'm stumped, but here's what I know:
If $f$ is continuous then $(\forall\epsilon>0)(\exists\delta>0)$ such that $d(x,y)<\delta \implies d(f(x), f(y)) < \epsilon$
So then $|f(x) - f(y)| < \epsilon$. How does the fact that $x,y\in B_r(a)$ related to $|f(x) - f(y)|$? I'm having trouble understanding precisely what $\inf_{r>0}(\sup \{|f(x) - f(y)| : x,y \in B_r(a)\})$ means. Please explain that as you help out with this proof.