Dimensions
Dimensions[expr]
finds the dimensions of expr
.
Attributes[Dimensions] := {Protected}
Simple examples
In[1]:= Dimensions[{{1, 3}, {1, 2}}] Out[1]= {2, 2}
In[2]:= Dimensions[{{{1, 2}, {3, 2}}, {{1, 2}}}] Out[2]= {2}
Further examples
In[1]:= Dimensions[foo] Out[1]= {}
Dimensions
works with any head, not just List
:
In[2]:= Dimensions[foo[]] Out[2]= {0}