This commit is contained in:
2026-01-19 05:43:29 +09:00
parent 40f41a4fd0
commit 0f6fddd794
36 changed files with 1724 additions and 0 deletions

22
guide/language/arrays.zig Normal file
View File

@@ -0,0 +1,22 @@
const std = @import("std");
const print = std.debug.print;
pub fn main() void {
const a = [5]u8{ 'h', 'e', 'l', 'l', 'o' };
const b = [_]u8{ 'w', 'o', 'r', 'l', 'd' };
for (a) |elem| {
print("{c}", .{elem});
}
print("\n", .{});
for (b) |elem| {
print("{c}", .{elem});
}
print("\n", .{});
const array = [_]u8{ 'h', 'e', 'l', 'l', 'o' };
const length = array.len;
print("----------------------------------\n", .{});
print("array: {s}\n", .{array});
print("length: {d}\n", .{length});
}