This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.
Newcomers to Zig will quickly learn that you can't switch on a string (i.e. []const u8 ). The following code gives us the unambiguous error message cannot switch on strings : switch (color) { "red" => {}, "blue" => {}, "green" => {}, "pink" => {}, else => {}, } I've seen two explanations for why this isn't supported. The first is that there's ambiguity around string identity. Are two strings only…
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.