mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-26 07:03:57 +00:00
Update zig.md: simpler multidimensional arrays
idea from https://www.reddit.com/r/Zig/comments/1ivzd4a/comment/meb8rvq/
This commit is contained in:
parent
42ff954780
commit
ea78a6c198
8
zig.md
8
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.
|
||||
|
Loading…
Reference in New Issue
Block a user