LengthWhile
LengthWhile[list,crit]
gives the number of contiguous elements ei starting at the beginning of list for which crit[ei] is True.
Examples
open allclose allGeneralizations & Extensions (1)
Properties & Relations (3)
LengthWhile gives the length of the result from TakeWhile:
LengthWhile is equal to Length if crit[ei] is True for all elements:
Otherwise it is 1 less than the first position for which crit[ei] is not True:
Possible Issues (1)
The count terminates for any value of crit[ei] that is not True:
Text
Wolfram Research (2007), LengthWhile, Wolfram Language function, https://reference.wolfram.com/language/ref/LengthWhile.html (updated 2008).
CMS
Wolfram Language. 2007. "LengthWhile." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2008. https://reference.wolfram.com/language/ref/LengthWhile.html.
APA
Wolfram Language. (2007). LengthWhile. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LengthWhile.html