top of page

Arrays

Arrays can be defined using {} 

 > arr = {1,2,3}

{1, 2, 3}

​

Items in the array can be accessed using the !! operator or using square brackets

> arr !! 0

1

> arr[1]

2

>arr[1] = 6

>arr

{1, 6, 3}

​

An item can be appended to the array using the <- operator.

> arr <- 4

{1, 2, 3, 4}

​

If an array contains tuple pairs then it can behave as a dictionary 

> arr = {(1,'a'),(2,'b'),(3,'c')}

{(1, 'a'), (2, 'b'), (3, 'c')}

> arr{2}

'b'

bottom of page