package coll type Iterator[T any] Vector[T] func (i Iterator[T]) ForEach(f func(int, T)) { for index := 0; index < i.length; index++ { f(index, i.array[index]) } } func (i Iterator[T]) ForBreak(f func(index int, t T, breaker func())) { var broke bool brk := func() { broke = true } for index := 0; index < i.length || !broke; index++ { f(index, i.array[index], brk) } }