Let $f:[a,b]\to\mathbb{R}$ a function such that $f$ has finite limit in every point $x \in [a,b]$, prove that $f$ is bounded.
I was thinking if this problem could be solved in the following way: since by hypothesis $f$ has finite limit for every $x \in [a,b]$, I can define $\tilde{f}:[a,b]\to \mathbb{R}$ such that $\tilde{f}$ has the same value of the limits of $f$ in every point of $[a,b]$. By doing this, $\tilde{f}$ is continuous in all $[a,b]$ and since $[a,b]$ is compact it follows that $\tilde{f}$ has absolute maximum and minimum in $[a,b]$ and these maximum and minimum are bounds for $f$ in $[a,b]$, hence $f$ is bounded. Could this work? If this is wrong, can someone explain me why it doesn't work? Moreover, is there a way to write formally the function $\tilde{f}$?