Skip to content

RTake

Name Mandatory Description Default Type
⬅️ Input The sequence from which elements will be extracted. BytesString[Any]
Output ➡️ The extracted elements. Any
Indices No One or more indices (counted backwards from the last element) to extract from a sequence. none Int[Int]Var(Int)Var([Int])

Works exactly like Take except that the selection indices are counted backwards from the last element in the target sequence. Also, RTake works only on sequences, not on tables.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
; RTake on sequences
[10 20 30 40] | RTake(1) | Log
Assert.Is(30 Break: true)

[10 20 30 40] | RTake([0 1]) | Log
Assert.Is([40 30] Break: true)

; RTake not valid on tables

; RTake using a variable as index
1 = index
[1 2 3 4] | RTake(index) | Log
Assert.Is(3 Break: true)

[info] [sample-wire] 30
[info] [sample-wire] [40 30]
[info] [sample-wire] 3