AllTrue

AllTrue[{e1,e2,},test]
yields True if is True for all of the .

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

DetailsDetails

  • AllTrue[list,test] only evaluates as many as are necessary to determine the result.
  • AllTrue[test][list] is equivalent to AllTrue[list,test].

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Test if all elements of a list satisfy a condition:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Test if all values of an association satisfy a condition:

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

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

In[3]:=
Click for copyable input
Out[3]=

TrueQ may be used to avoid getting a symbolic result:

In[4]:=
Click for copyable input
Out[4]=
Introduced in 2014
(10.0)