undefined refernce to loop

Thankyou paulS, sorry for the silly newbie questions i've been thrown in the deep end with programming but i'm slowly getting there.