Add var to declare loop index as local