For complex numbers $z$, let
\[f(z) = \left\{ \begin{array}{cl} z^{2}&\text{ if }z\text{ is not real}, \\ z+2 &\text{ if }z\text{ is real}. \end{array} \right.\]
Find $f(i)+f(1)+f(-1)+f(-i)$.
1 and -1 are real numbers and i and -i are nonreal numbers.
Just directly plug it in according to the piecewise function:
\(i^2+1+2-1+2+(-i)^2 =-1+4-1=\boxed{2}\)