time-to-botec/squiggle/node_modules/@stdlib/ndarray/base/clamp-index/docs/repl.txt

30 lines
428 B
Plaintext
Raw Normal View History

{{alias}}( idx, max )
Restricts an index to the interval [0,max].
Parameters
----------
idx: integer
Index to clamp.
max: integer
Maximum index value.
Returns
-------
out: integer
Clamped index.
Examples
--------
> var idx = {{alias}}( 2, 10 )
2
> idx = {{alias}}( -5, 10 )
0
> idx = {{alias}}( 15, 10 )
10
See Also
--------