Skip to content
Chung Leong edited this page Feb 11, 2024 · 12 revisions

In Zig, arrays can contain only a single type of values. Their lengths are fixed at compile time.

const std = @import("std");

pub fn print4(values: i32) void {
    std.debug.print("{d}\n", .{values});
}
import { print4 } from './array-example-1.zig';

print4([ 123, 234, 345, 456 ]);
123, 234, 345, 456

Array objects support bracket operator and iterator.

Clone this wiki locally