Can a limit exist at $x\to a$ but not equal to $f(a)$? In the calculus course I'm taking, the conditions for a continuous function are said to be when
a.) $\lim_{x\to a}f(x)$ exists 
and 
b.) $\lim_{x\to a}f(x)$ = $f(a)$
And it seems a little redundant, since if a limit exists at $x\to a$, wouldn't it always equal to $f(a)$? Are there situations where that is not the case?
I apologize if this was a bad question/ formatted bad, I'm pretty new to math and this site in general.
 A: No.
$$
f(x)=
\begin{cases} 
      2, x=0\\
      x, x \ne0 \\
   \end{cases}
$$
$f(0)=2$, but $\lim_{x\to 0}f(x)=\lim_{x\to 0}x=0$.
A: You can have a function with a hole in it, for example:

A: In fact, the function may not even be defined at $a$. One example is
$$f(x) = 
\begin{cases}
-x + 4 & \text{if $x \neq 0$}. 
\end{cases} 
$$
Then $\lim\limits_{x \to 0} f(x) = 4$, but $f(0)$ doesn't exist. I could also define $f(0)$ to be anything, say, $5$. Then the limit exists and is equal to $4$, but differs from $f(0)$. In either of these cases, $f(x)$ is not continuous at $x = 0$.
A: This confusion often occurs because most, if not all, of the functions people are acquainted with in elementary calculus are continuous. In other words, they do have the property that if $f$ is defined at $a$, then $\lim_{x \to a}f(x)$ exists and is equal to $f(a)$. But not every function is like this. Consider, for example, the sign function or signum function, written as $\DeclareMathOperator{\sgn}{sgn}\sgn$:
$$
\sgn(x)=
\begin{cases}
1 & \text{if $x>0$} \, ,\\
0 & \text{if $x=0$} \, ,\\
-1 & \text{if $x<0$} \, .
\end{cases}
$$
It's called the sign function because it tells us whether a real number is positive, negative, or zero. Note that $\sgn$ is defined at $0$, but not continuous at $0$. It is continuous at all other points.
