fixed example code loop