Tuple - chung-leong/zigar GitHub Wiki

A tuple in the Zig language is basically an anonymous struct with sequential numeric field names. You don't specify the names when you define one:

pub const tuple = .{ 123, 3.14, .hello };

In JavaScript, a tuple is treated as an array:

import { tuple } from './tuple-example-1.zig';

console.log(tuple.length);
for (const element of tuple) {
    console.log(element);
}
console.log([ ...tuple ]);
console.log(tuple.valueOf());
console.log(JSON.stringify(tuple));
3
123
3.14
hello
[ 123, 3.14, 'hello' ]
[ 123, 3.14, 'hello' ]
[123,3.14,"hello"]