NestWhile
NestWhile(f, expr, test)applies a function
frepeatedly on an expressionexpr, until applyingteston the result no longer yieldsTrue.
NestWhile(f, expr, test, m)supplies the last
mresults totest(default value:1).
NestWhile(f, expr, test, All)supplies all results gained so far to
test.
Examples
Divide by 2 until the result is no longer an integer:
>> NestWhile(#/2&, 10000, IntegerQ)625/2Related terms
FixedPoint, FixedPointList, Nest
Implementation status
- ✅ - full supported