Skip to content

Scan

Scan[fn, list] evaluates fn[elem] for each element in list.

Attributes[Scan] := {Protected}

Simple examples

In[1]:= Scan[Function[If[(Slot[1]) > (5), Return[Slot[1]]]], {1, 6, 9}]
Out[1]= 6
In[2]:= Catch[CompoundExpression[Scan[Function[If[IntegerQ[Slot[1]], Null, Throw[False]]], {a}], True]]
Out[2]= False
In[3]:= Catch[CompoundExpression[Scan[Function[If[IntegerQ[Slot[1]], Null, Throw[False]]], {1, 2}], True]]
Out[3]= True
In[4]:= Catch[CompoundExpression[Scan[Function[If[IntegerQ[Slot[1]], Null, Throw[False]]], {1, a}], True]]
Out[4]= False