feat: update single files compile error

This commit is contained in:
2025-01-17 00:43:20 +08:00
parent 4ab4672239
commit 0f61f6bd3d
3 changed files with 5 additions and 5 deletions

View File

@@ -2,7 +2,7 @@ const print = @import("std").debug.print;
pub fn main() void {
const string = [_]u8{ 'a', 'b', 'c' };
for (string) |character, index| {
for (string, 0..) |character, index| {
print("{} - {}\n", .{index, character});
}
}

View File

@@ -1,7 +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});
const a: ?i32 = null;
const b = a orelse 1;
print("{?} {} \n", .{a, b});
}

View File

@@ -4,7 +4,7 @@ const print = std.debug.print;
pub fn main() void {
var sum: i32 = 0;
var i: i32 = 0;
while (i <100) : (i += 1) {
while (i < 100) : (i += 1) {
sum += i;
}
print("Sum: {}\n", .{sum});