instead of with getting next index in the end of loop ``` set ind=$order(array("")) for { quit:ind="" /// some code here set ind=$order(array(ind)) } ``` should be ``` set ind="" for { set ind=$order(array(ind)) quit:ind="" /// some code here } ```