Methods

limitΒΆ

limit(a:Arr, l:Int)

Truncate an array if necessary so it would have maximum l elements.
Source: stdlib.ngs:1391

a

Array to (possibly) truncate.

l

Maximum elements

Returns

Either a or new Arr of length l

Example

[10,11,12].limit(2)   # [10,11]
[10,11,12].limit(10)  # [10,11,12]