For a data set $\bigcup_{i=1}^nx_i$ of $n$ values with mean $\bar{x}$ the variance is defined as $$\sigma^2=\frac{\displaystyle\sum_{i=1}^n(x_i-\bar{x})^2}{n}$$
My textbook says that “the square ensures that each term in the sum is positive, which is why the sum turns out not to be zero.” However wouldn’t $$\sigma^2=\frac{\displaystyle\sum_{i=1}^n|x_i-\bar{x}|}{n}$$ also prevent a sum of zero?