Skip to content

Pair Reference

A Pair allows two values to be stored and accessed together.

var pair = Pair(1, 2);
var left = pair.left; // 1
var right = pair.right; // 2

Can be used to access to first element of the pair to set/get it.

var pair = Pair(nil, 2);
pair.left = 1;
var left = pair.left; // 1

dyn!

Can be used to access to second element of the pair to set/get it.

var pair = Pair(1, nil);
pair.right = 2;
var right = pair.right; // 2

dyn!

Returns an array of the Pair values.

var pair = Pair(1, 2);
var arr = pair.to_array(); // [1, 2]

None

[dyn!] - An containing the left and right values of the Pair, in that order.