diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-04 18:29:09 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-04 18:29:09 -0400 |
| commit | 7b735ab6fc3e0bb368f1ca484168eaefbbe3ce9c (patch) | |
| tree | 4a7c78bb0967b8fbc1042d901cf0346705d9d0d8 /docs/optionals.md | |
| parent | 0b8074154e2671691050bdb3bcb33245625a056c (diff) | |
Misc fixes
Diffstat (limited to 'docs/optionals.md')
| -rw-r--r-- | docs/optionals.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/optionals.md b/docs/optionals.md index 84f886b7..ff4252d1 100644 --- a/docs/optionals.md +++ b/docs/optionals.md @@ -40,7 +40,7 @@ example, if you wanted to declare a variable that could be either an integer value or `none` and initialize it as none, you would write it as: ```tomo -x := none:Int +x : Int = none ``` Similarly, if you wanted to declare a variable that could be an array of texts @@ -57,7 +57,7 @@ keep open the possibility of assigning `none` later, you can use the postfix ```tomo x := 5? # Later on, assign none: -x = !Int +x = none ``` ## Type Inference @@ -86,7 +86,7 @@ Non-none values can also be automatically promoted to optional values without the need for an explicit `?` operator in the cases listed above: ```tomo -x := !Int +x : Int? = none x = 5 func doop(arg:Int?)->Text?: @@ -109,7 +109,7 @@ maybe_x := 5? >> maybe_x or fail("No value!") = 5 : Int -maybe_x = !Int +maybe_x = none >> maybe_x or -1 = -1 : Int >> maybe_x or fail("No value!") |
