Error in returning value from function loop

Put local y in front of the loop.

2 Likes