size

size(x)

Try it yourself:


size(): Inspecting Array Dimensions

size() returns the dimensions of an array or matrix. It is essential for validating data before matrix operations, slicing, or reshaping.

Prevent shape errors

Check size before multiply(), reshape(), or concat(). Matching total counts is not always enough: matrix multiplication requires compatible inner dimensions.

Use row() and column() after confirming an index is present. For an empty collection, dimensions can still be meaningful, so handle zero-length axes explicitly.

All functions