My textbook describes a case for a function - $f(x)$ to be discontinuous at $x = a$ if:
At least one of the limits does not exist
Where 'limits' refers to Left hand limit and Right hand limit. I understand that a function would automatically be discontinuous if the limit at x tending to a does not exist (i.e: LHL $\ne$ RHL). However, it is my understanding that if the limit is taking at the endpoint of the domain of a given function such that the function's domain itself doesn't span to < a or > a then the value that the function tends to from the side where the domain does exists is taken as the valid limit at that point.
To further explain what I've understood so far, let's assume function $f(x) =$ $\sqrt x$. Now, at x tending to $0$, the LHL does not exist as from $0$- the domain of the function itself isn't defined, however, the $RHL = 0$ and that is what we take the valid limit of the function to be.
Here, if we are to talk about continuity, if the LHL doesn't exist owing to the fact that the function's domain doesn't extend to that point but $RHL = f(a)$ and both exist is the function considered discontinuous at $a$?
For example if I were to pose the question at $x = 0$, is $\sqrt x$ continuous or discontinuous what would the answer be?
Also, if my intuition is right and the function is continuous at $0$, then what happens if I define a piece-wise function such that for all:
$x > -2$ then $f(x) = \sqrt x$
$x \leq -2$ then $f(x) = 5$
Is this function discontinuous?
[Note: Assume the codomain of all the function is the set of Real numbers.]
[Update: The first part of my question has been summarily answered here.]