Capy-Bearer Documentation

array_merge

lib call

Capy

function array_merge(left : any, right : any) any

Description

array_merge combines two any values. It returns a new value.

For maps, values from right replace matching values from left without moving their positions. Left entries retain their order. New keys append in right insertion order. The result shares child objects with both inputs.

Two lists concatenate in numeric order. If either container is a map, the function merges keys, including numeric-looking keys. It does not infer a list from map keys.

Parameters

left : first value

right : second value

Return Values

a merged any value

Example

Capy

var merged := array_merge({"name": "Ada"}, {"role": "admin"})
print(merged["name"], " ", merged["role"], "\n")

Output

Ada admin