array_rotate_right()
Rotates values inside a dynamic
array to the right.
Syntax
array_rotate_right(
array, rotate_count)
Arguments
- array: Input array to rotate, must be dynamic array.
- rotate_count: Integer specifying the number of positions that array elements will be rotated to the right. If the value is negative, the elements will be rotated to the left.
Returns
Dynamic array containing the same amount of the elements as in the original array, where each element was rotated according to rotate_count.
See also
- For rotating array to the left, see array_rotate_left().
- For shifting array to the left, see array_shift_left().
- For shifting array to the right, see array_shift_right().
Examples
- Rotating to the left by two positions by using negative rotate_count value:
print arr=dynamic([1,2,3,4,5])
| extend arr_rotated=array_rotate_right(arr, -2)
Results
arr | arr_shift |
---|---|
[1,2.3,4.5] | [3,4,5,1,2] |