Does $$\left|\lim_{N \rightarrow \infty} f(N)\right|^2 = \lim_{N \rightarrow \infty} |f(N)|^2, \tag{1}$$ where $f(N)$ is a function of $N$ and $N$ is a natural number?
Here is my try: $y(x)=|x|^2$ is a continuous function of $x$, so (1) is true. Am I right?
Define $f:\mathbb{N}\to\mathbb{C}$ by $$ f(n)=\begin{cases} 1,&\text{$n$ is odd}\\ -1,&\text{$n$ is even} \end{cases}. $$ Then $\lim_{n\to\infty}|f(n)|^2=1$, but $\lim_{n\to\infty}f(n)$ does not exist and $\left|\lim_{n\to\infty} f(n)\right|^2$ does not, either. If $\lim_{n\to\infty}f(n)$ exists, then the equation holds.