A function is said to be continuous. Can it still have vertical asymptotes?

It doesn't make sense to ask whether a function is continuous at a point where it's not defined. So if it has a vertical asymptote, then that's not a point of discontinuity, but rather a point that is not part of the domain.

To make it clear what I mean by "doesn't make sense", the definition of continuity at a point $x$ involves the expression $|f(x) - f(y)|$. If $x$ is such that $f(x)$ doesn't make sense, then neither does that expression, so asking about continuity is meaningless.


The function $f\colon \Bbb R\setminus\{0\}\to\Bbb R$ given by $f(x)=\frac 1x$ is continuous on all of its domain. Yet there is a vertical asymptote.


An important notion not mentioned in any answer so far is compactness. There is a formal definition of this (https://en.wikipedia.org/wiki/Compact_space) which can be applied to any abstract domain that your function might be defined on, but if your domain is a subset of the number line then it's enough to check whether it's bounded (doesn't "stretch off" to infinity) and closed (includes all its "end points"). Other answers have given various examples of functions which were continuous on their domain and still included a vertical asymptote, but that asymptote was always an "end point" of the domain that was not included in the domain itself; so the domain was not closed and hence not compact.

In general, the image of a compact region under any continuous function will always be compact; so, if a function has values in the numberline (or any other metric space) then the set of values of the function on any compact region of its domain must be compact, and hence bounded, and there can be no vertical asymptote.