utils: assign length vars of array loops in for