func (q Query) TakeWhile(f func(T) (bool, error)) (r Query) {
	n, err := q.findWhileTerminationIndex(f)
	if err != nil {
		r.err = err
		return
	}
	return q.Take(n)
}
// TakeWhile returns a new query with elements from the original sequence
// by testing them with provided predicate f and stops taking them first
// predicate returns false.
//
// Example:
// 	arr, err := From([]int{40,10,50,60,100})
// 		.OrderInts()
//		.TakeWhile(func (i T)(bool, error){
//			return i.(int) <= 50, nil
// 		}).Results()
//	if err == nil {
//		// arr will be 10, 40, 50
// 	}
TakeWhile returns a new query with elements from the original sequence
by testing them with provided predicate f and stops taking them first
predicate returns false.


// TakeWhile returns a new query with elements from the original sequence // by testing them with provided predicate f and stops taking them first // predicate returns false . // // Example : // arr err : = From ( [] int { 40 10 50 60 100 } ) // . OrderInts () // . TakeWhile ( func ( i T ) ( bool error ) { // return i . ( int ) < = 50 nil // } ) . Results () // if err == nil { // // arr will be 10 40 50 // }
func (q Query) TakeWhile(f func(T) (bool, error)) (r Query) {
	n, err := q.findWhileTerminationIndex(f)
	if err != nil {
		r.err = err
		return
	}
	return q.Take(n)
}
func ( q Query ) TakeWhile ( f func ( T ) ( bool , error ) ) ( r Query ) { n , err := q . findWhileTerminationIndex ( f ) if err != nil { r . err = err return } return q . Take ( n ) }
TakeWhile returns a new query with elements from the original sequence
by testing them with provided predicate f and stops taking them first
predicate returns false.
TakeWhile returns a new query with elements from the original sequence by testing them with provided predicate f and stops taking them first predicate returns false .