use const for variables that are never modified

This commit is contained in:
Adam Millerchip
2021-12-26 13:24:01 +09:00
parent f0357ea91c
commit 39e432748e
4 changed files with 6 additions and 6 deletions

View File

@@ -29,12 +29,12 @@ const MyNumberError = error{
const std = @import("std");
pub fn main() void {
var nums = [_]u8{ 2, 3, 4, 5, 6 };
const nums = [_]u8{ 2, 3, 4, 5, 6 };
for (nums) |num| {
std.debug.print("{}", .{num});
var n = numberMaybeFail(num);
const n = numberMaybeFail(num);
if (n) |value| {
std.debug.print("={}. ", .{value});
} else |err| switch (err) {