feat: add forfor.zig, optionals.zig

This commit is contained in:
2022-08-27 21:28:28 +08:00
parent e643e7e93e
commit 9167038e92
2 changed files with 16 additions and 0 deletions

9
single_files/forfor.zig Normal file
View File

@@ -0,0 +1,9 @@
const print = @import("std").debug.print;
pub fn main() void {
for ([_]i32 { 1, 3, 4, 5, 6 }) |i| {
for ([_]i32 { 10, 20, 30}) |j| {
print("{} * {} = {}\n", .{i, j, i * j});
}
}
}

View File

@@ -0,0 +1,7 @@
const print = @import("std").debug.print;
pub fn main() void {
var a: ?i32 = null;
var b = a orelse 1;
print("{} {} \n", .{a, b});
}