Is $\lim_{n\to \infty}f(x_n)=f(\lim_{n\to \infty}x_n)$ always true? I was studying about sequences of numbers and their limits. My book states the standard rules for algebra of limits involving sums, differences, products and quotients of convergent sequences.
But the author, while solving an example problem implicitly used the fact that
$$\lim_{n\to \infty}\sqrt{\frac{1}{n+1}} = \frac{1}{\sqrt{\lim_{n\to \infty}(n)+1}}=0$$ 
But my question is can we generalise this result to be applicable to all types of functions...
I found this answer for composite functions - limit of composite function underlying principles and special cases
But since the definitions of limits of number sequences and limit of a function are different, how do we formally prove the following result (this is not a composite function as such..)?
$$\lim_{n\to \infty}{f(x_n)}=f(\lim_{n\to \infty}{x_n})\ \ where  \ \ n\in \mathbb N$$
Here $x_n$ is a sequence of real numbers and its range is contained in the domain of $f$. Also, is this result applicable in all cases..if not...when can it be used..
I am specifically looking for a formal proof of the statement..in those cases where it is applicable
Thanks for any answers!!

Not true in general.  For a simple example, let $f(x)=\begin{cases} x,\,x\ne1\\2,\,x=1\end{cases}$.
  Now consider a sequence converging to $1$, like $x_n=1+1/n$.
There's a limit point definition of continuous functions that you may want to take a look at.  In particular, it's true when $f$ is continuous.
