Skip to main content

List / Array

append

  • append(list, element)
    • if list is primitive string and element is primitive string, return a new string
    • if list is primitive list type and element is primitive value, appends element to the primitive value list
    • if list is primitive json type and element is primitive value, appends element to the json array
    • if list is tuple type, append element to the tuple
    • else return error
let s = "ab"
s = append(s, "cd") // s is now the string "abcd"

let src = [1, 2, 3, 4]
append(src, 5) // src is still [1, 2, 3, 4] as it's value is not set to after append
src = append(src,5) // src is now [1, 2, 3, 4, 5]

concat

  • concat(list1, list2)
    • merge two list type input into one new list
let a = [1, 2]
let b = [3, 4]
let c = concat(a, b) // c is now [1, 2, 3, 4]