AllTrue

AllTrue[{e1,e2,},test]

yields True if test[ei] is True for all of the ei.

AllTrue[expr,test,level]

tests parts of expr at level level.

AllTrue[test]

represents an operator form of AllTrue that can be applied to an expression.

Details

• AllTrue[list,test] and AllTrue[list,test,level] only evaluate as many test[ei] as are necessary to determine the result.
• AllTrue[list,test] is equivalent to AllTrue[list,test,1].
• AllTrue[test][list] is equivalent to AllTrue[list,test].

Examples

open allclose all

Basic Examples(4)

Test if all elements of a list satisfy a condition:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Check if all elements of a matrix satisfy a condition:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Test if all values of an association satisfy a condition:

 In[1]:=
 Out[1]=

If the condition applied to no element produces False, a symbolic result may be returned:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Even when the condition applied to some elements is symbolic, a definitive result may be deduced:

 In[3]:=
 Out[3]=

TrueQ may be used to avoid getting a symbolic result:

 In[4]:=
 Out[4]=