Zig's Temporary Variable are Const

from blog openmymind.net, | ↗ original
I frequently run into a silly compilation error which, embarrassingly, always takes me a couple of seconds to decipher. This most commonly happens when I'm writing tests. Here's a simple example: fn add(values: []i64) i64 { var total: i64 = 0; for (values) |v| { total += v; } return total; } test "add" { const actual = add(&.{1, 2,...