For complex numbers $z$, let
f(z)={z2 if z is not real,z+2 if z is real.
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:
i2+1+2−1+2+(−i)2=−1+4−1=2