my ziglings
0

Configure Feed

Select the types of activity you want to include in your feed.

update description of 050_no_value for clarity

Robert Fry (Mar 9, 2026, 11:16 PM UTC) de3c99dd 1be6fcd7

+7 -8
+7 -8
exercises/050_no_value.zig
··· 14 14 // 15 15 // "undefined" should not be thought of as a value, but as a way 16 16 // of telling the compiler that you are not assigning a value 17 - // _yet_. Any type may be set to undefined, but attempting 18 - // to read or use that value is _always_ a mistake. 17 + // _yet_. Any variable may be set to undefined, but attempting to 18 + // read its value before assigning one _always_ a mistake. 19 19 // 20 20 // * null 21 21 // ··· 24 24 // The "null" primitive value _is_ a value that means "no value". 25 25 // This is typically used with optional types as with the ?u8 26 26 // shown above. When foo equals null, that's not a value of type 27 - // u8. It means there is _no value_ of type u8 in foo at all! 27 + // u8. It means you have assigned foo to have _no value_! 28 28 // 29 29 // * error 30 30 // ··· 32 32 // 33 33 // Errors are _very_ similar to nulls. They _are_ a value, but 34 34 // they usually indicate that the "real value" you were looking 35 - // for does not exist. Instead, you have an error. The example 36 - // error union type of MyError!u8 means that foo either holds 37 - // a u8 value OR an error. There is _no value_ of type u8 in foo 38 - // when it's set to an error! 35 + // for does not exist. Instead of "no value", you have an error. 36 + // The example error union type of MyError!u8 means that foo 37 + // either holds a u8 value OR a MyError error. 39 38 // 40 39 // * void 41 40 // ··· 55 54 // * undefined - there is no value YET, this cannot be read YET 56 55 // * null - there is an explicit value of "no value" 57 56 // * errors - there is no value because something went wrong 58 - // * void - there will NEVER be a value stored here 57 + // * void - there will NEVER be a value here 59 58 // 60 59 // Please use the correct "no value" for each ??? to make this program 61 60 // print out a cursed quote from the Necronomicon. ...If you dare.