It would be nice if we had syntax to destructure arrays, objects and other types.
Syntax could look something like this:
let my_array = [0, 1, 2];
let [a, b, c] = my_array;
print(a); // 0
print(b); // 1
print(c); // 2
This is similar to JavaScript and this also lets you emulate tuples! Like:
let my_tuple = ["Hello", "World!"];
let [hello, world] = my_tuple;
print(hello); // Hello
print(world); // World!
It would be nice if we had syntax to destructure arrays, objects and other types.
Syntax could look something like this:
This is similar to JavaScript and this also lets you emulate tuples! Like: