This commit is contained in:
krahets
2023-07-11 01:02:48 +08:00
parent b1544c92ca
commit cd145751e2
9 changed files with 449 additions and 48 deletions

View File

@@ -1078,7 +1078,7 @@ elementAddr = firtstElementAddr + elementLength * elementIndex
// 在数组中查找指定元素
fn find(nums: []i32, target: i32) i32 {
for (nums, 0..) |num, i| {
if (num == target) return @intCast(i32, i);
if (num == target) return @intCast(i);
}
return -1;
}