From ea78a6c1981c61413ce15964416c39873ecca4b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Fro=C5=82ow?= Date: Mon, 24 Feb 2025 13:55:15 +0100 Subject: [PATCH] Update zig.md: simpler multidimensional arrays idea from https://www.reddit.com/r/Zig/comments/1ivzd4a/comment/meb8rvq/ --- zig.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zig.md b/zig.md index ad56a471..75becf37 100644 --- a/zig.md +++ b/zig.md @@ -153,10 +153,10 @@ try some_integers[i]; // Runtime error 'index out of bounds'. ```zig const mat4x4 = [4][4]f32{ - [_]f32{ 1.0, 0.0, 0.0, 0.0 }, - [_]f32{ 0.0, 1.0, 0.0, 1.0 }, - [_]f32{ 0.0, 0.0, 1.0, 0.0 }, - [_]f32{ 0.0, 0.0, 0.0, 1.0 }, + .{ 1, 0, 0, 0 }, + .{ 0, 1, 0, 1 }, + .{ 0, 0, 1, 0 }, + .{ 0, 0, 0, 1 }, }; // Access the 2D array then the inner array through indexes.