Merge pull request 'update description of 050_no_value for clarity' (#373) from robertefry/ziglings_exercises:fix/050-clarity into main

Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/373
This commit is contained in:
Chris Boesch 2026-03-11 00:03:12 +01:00
commit 1de4e14096

View File

@ -14,8 +14,8 @@
// //
// "undefined" should not be thought of as a value, but as a way // "undefined" should not be thought of as a value, but as a way
// of telling the compiler that you are not assigning a value // of telling the compiler that you are not assigning a value
// _yet_. Any type may be set to undefined, but attempting // _yet_. Any variable may be set to undefined, but attempting to
// to read or use that value is _always_ a mistake. // read its value before assigning one is _always_ a mistake.
// //
// * null // * null
// //
@ -24,7 +24,7 @@
// The "null" primitive value _is_ a value that means "no value". // The "null" primitive value _is_ a value that means "no value".
// This is typically used with optional types as with the ?u8 // This is typically used with optional types as with the ?u8
// shown above. When foo equals null, that's not a value of type // shown above. When foo equals null, that's not a value of type
// u8. It means there is _no value_ of type u8 in foo at all! // u8. It means you have assigned foo to have _no value_!
// //
// * error // * error
// //
@ -32,10 +32,9 @@
// //
// Errors are _very_ similar to nulls. They _are_ a value, but // Errors are _very_ similar to nulls. They _are_ a value, but
// they usually indicate that the "real value" you were looking // they usually indicate that the "real value" you were looking
// for does not exist. Instead, you have an error. The example // for does not exist. Instead of "no value", you have an error.
// error union type of MyError!u8 means that foo either holds // The example error union type of MyError!u8 means that foo
// a u8 value OR an error. There is _no value_ of type u8 in foo // either holds a u8 value OR a MyError error.
// when it's set to an error!
// //
// * void // * void
// //
@ -55,7 +54,7 @@
// * undefined - there is no value YET, this cannot be read YET // * undefined - there is no value YET, this cannot be read YET
// * null - there is an explicit value of "no value" // * null - there is an explicit value of "no value"
// * errors - there is no value because something went wrong // * errors - there is no value because something went wrong
// * void - there will NEVER be a value stored here // * void - there will NEVER be a value here
// //
// Please use the correct "no value" for each ??? to make this program // Please use the correct "no value" for each ??? to make this program
// print out a cursed quote from the Necronomicon. ...If you dare. // print out a cursed quote from the Necronomicon. ...If you dare.