All variables you use must be defined. You haven't defined the variable i, so the compiler complains and rightly so.
Good luck with your exercises.