Product SiteDocumentation Site

5.3.6.12. dimension


>>-dimension-+-----+-------------------------------------------><
             +-(n)-+

Returns the current size (upper bound) of dimension n (a positive whole number). If you omit n, this method returns the dimensionality (number of dimensions) of the array. If the number of dimensions has not been determined, 0 is returned.

Example 5.137. Array class - dimension method

a = .array~of(,"Mike", "Rick")
say a~dimension     -- says: 1 (number of dimensions in the array)
say a~dimension(1)  -- says: 3 (upper bound of dimension one)

a = .array~new~~put("Mike",1,1)~~put("Rick",1,2)
say a~dimension     -- says: 2 (number of dimensions in the array)
say a~dimension(1)  -- says: 1 (upper bound of dimension one)
say a~dimension(2)  -- says: 2 (upper bound of dimension two)