4 ms·
What I took from the article is that it's useful when combined with type inference. So in Zig you could do: var x : u8 = 5; var y = @as(u32, x); OR va
by AndresNavarro 5y ago
What I took from the article is that it's useful when combined with type inference. So in Zig you could do:
var x : u8 = 5;
var y = @as(u32, x);
OR
var x : u8 = 5;
var y : u32 = x;
The cast is needed in the first case to force the inference y: u32, otherwise it would be y: u8