I got got
I got got
I'm recovering from getting my wisdom teeth removed and decided to finally learn Zig to kill some time. Started up Ziglings and everything was completely smooth until the Exercise that had Error Unions. Couldn't figure out for the life of me why I was getting an Error for doing exactly what the exercise taught me to do though!!
var my_number: u8|MyNumberError = 5;
I tried reading the error messages, checked if maybe my zls version was set to something wrong, checked the ziglang changelog if maybe the syntax changed between v16 and v17, checked the Issues tabs on the Ziglings git to see if anyone else had this issue, and then re-checked the zig documentation on my phone just to realize:
The Error union type is supposed to be defined with an exclamation mark (!) instead of a pipe (|), I was just misreading it because I'm not wearing my glasses! And I guess I'm used to seeing pipes used in types because it's common in TypeScript haha