While teaching us about limits, my math teacher showed us how to define a function with a "hole" in it:
$$f(x)=\begin{cases}x^2, & x \neq 2 \\ \text{undefined}, & x=2\end{cases}$$
This is really confusing me, why do I have to define that a value is undefined?
I asked her, and her reasoning is that if you don't write that for $x=2$ there is no value, then it could be any value possible, like $7$ or $42$ as the function has only be written partially. She added that it is only I who thinks that it is undefined, for everyone else, it could be anything, and thus, I have to explicitly write that the function has no value for $2$, or else it wouldn't be mathematically correct.
I don't understand the reasoning for the following reason: If I write
$$f(x)=x^2, \text{ for } x\neq 2$$
then the function is already undefined for the value is $2$, as the function has no formula if $x=2$. And thus, the value is undefined, I don't have to write it again that it is in fact undefined.
After a while, she dismissed me by saying that it is only a formality, and as a result not important.
But I really want to know, so where is my flaw? Or rather, why do I have specify that the function is undefined for $2$ explicitly?