Code for the loops tutorial