func (iter Enumerator) TakeWhile(criteria func(interface{}, uint) bool) Enumerator {
	results := make(chan interface{})

	go func() {
		defer close(results)
		i := uint(0)
		for entry := range iter {
			if !criteria(entry, i) {
				return
			}
			i++
			results <- entry
		}
	}()

	return results
}
func (iter Enumerator) TakeWhile(criteria func(interface{}, uint) bool) Enumerator {
	results := make(chan interface{})

	go func() {
		defer close(results)
		i := uint(0)
		for entry := range iter {
			if !criteria(entry, i) {
				return
			}
			i++
			results <- entry
		}
	}()

	return results
}
func ( iter Enumerator ) TakeWhile ( criteria func ( interface { } , uint ) bool ) Enumerator { results := make ( chan interface { } ) go func ( ) { defer close ( results ) i := uint ( 0 ) for entry := range iter { if ! criteria ( entry , i ) { return } i ++ results <- entry } } ( ) return results }
// TakeWhile continues returning items as long as 'criteria' holds true.
TakeWhile continues returning items as long as criteria holds true .