There is a For / Break instruction in ladder and then in structured text loops are even more straight forward. "next" is not really needed it will work out to be a for instruction that points to a routine that will scan and then finished should increment the loop which has a start point set as well as iterations and I imagine the break can be used in the looped routine to break out otherwise it would loop until the termination value is met by the index. (I am looking in version 32 of studio5000)