AllTrue
Examples
open all close allBasic Examples (4)
Test if all elements of a list satisfy a condition:
AllTrue[{2, 3, 4, 6, 8}, EvenQ]AllTrue[{2, 4, 6, 8}, EvenQ]Check if all elements of a matrix satisfy a condition:
AllTrue[{{1, 2, 3}, {4, 5, 6}}, EvenQ, 2]AllTrue[{{2, 4, 6}, {8, 10, 12}}, EvenQ, 2]Test if all values of an association satisfy a condition:
AllTrue[<|"a" -> 1, "b" -> 3, "c" -> 5|>, OddQ]If the condition applied to no element produces False, a symbolic result may be returned:
AllTrue[{2, 6, x, 4, y}, # < 10&]% /. {x -> 3, y -> 7}Even when the condition applied to some elements is symbolic, a definitive result may be deduced:
AllTrue[{2, 6, x, 4, y, 15}, # < 10&]TrueQ may be used to avoid getting a symbolic result:
AllTrue[{2, 6, x, 4, y}, TrueQ[# < 10]&]Scope (3)
AllTrue may be applied to expressions with any head:
AllTrue[f[1, 7, 3], OddQ]AllTrue[f[x, y, z], # < 10&]AllTrue can operate on ragged expressions:
AllTrue[{{1, 2, 3}, {4, 5}}, IntegerQ, 2]AllTrue[f[{1, 2, 3}, {4, 5}], IntegerQ, 2]By default, AllTrue always operates at level 1:
AllTrue[3, EvenQ]AllTrue[{}, EvenQ]AllTrue[3, EvenQ, 0]Properties & Relations (5)
Compose the predicate with TrueQ to make the predicate stronger:
AllTrue[{x, y, z}, Composition[TrueQ, f]]AllTrue[list,f] is equivalent to NoneTrue[list,Composition[Not,f]]:
LogicalExpand /@ {AllTrue[{x, y, z}, f], NoneTrue[{x, y, z}, !f[#]&]}AllTrue[list,f] is equivalent to VectorQ[list,f] when f evaluates to True or False:
AllTrue[Range[10], IntegerQ]
VectorQ[Range[10], IntegerQ]AllTrue[{x, y, z}, # < 10&]
VectorQ[{x, y, z}, # < 10&]AllTrue[list,f] works efficiently on sparse vectors:
AllTrue[SparseArray[{1000 -> 2}, {1000000000000}], EvenQ]AllTrue[list,test] checks the parts of list in order, stopping as soon as test returns False:
AllTrue[{1, 2, 3, 4, 5}, (Print[#];OddQ[#])&]Text
Wolfram Research (2014), AllTrue, Wolfram Language function, https://reference.wolfram.com/language/ref/AllTrue.html (updated 2015).
CMS
Wolfram Language. 2014. "AllTrue." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/AllTrue.html.
APA
Wolfram Language. (2014). AllTrue. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AllTrue.html
BibTeX
@misc{reference.wolfram_2026_alltrue, author="Wolfram Research", title="{AllTrue}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/AllTrue.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_alltrue, organization={Wolfram Research}, title={AllTrue}, year={2015}, url={https://reference.wolfram.com/language/ref/AllTrue.html}, note=[Accessed: 12-June-2026]}