aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2024-01-23 13:45:36 +0000
committerLouis Pilfold <louis@lpil.uk>2024-01-23 13:45:36 +0000
commit17d738a6932f95859104f0945c04f50ca574b029 (patch)
treefd2090c4f6c907296f4d5d9126f3f0a35b49a703 /src/content
parentc4cace1654989d3e1bbbf97040fb69c7f6bc1ca6 (diff)
downloadtour-17d738a6932f95859104f0945c04f50ca574b029.tar.gz
tour-17d738a6932f95859104f0945c04f50ca574b029.zip
Correct other code
Diffstat (limited to 'src/content')
-rw-r--r--src/content/chapter2_flow_control/lesson02_variable_patterns/code.gleam10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/content/chapter2_flow_control/lesson02_variable_patterns/code.gleam b/src/content/chapter2_flow_control/lesson02_variable_patterns/code.gleam
index 7bcc93c..288bfb0 100644
--- a/src/content/chapter2_flow_control/lesson02_variable_patterns/code.gleam
+++ b/src/content/chapter2_flow_control/lesson02_variable_patterns/code.gleam
@@ -2,15 +2,13 @@ import gleam/io
import gleam/int
pub fn main() {
- let x = int.random(5)
- io.debug(x)
-
- let result = case x {
+ let result = case int.random(5) {
// Match specific values
0 -> "Zero"
1 -> "One"
- // Match any other value
- _ -> "Other"
+
+ // Match any other value and assign it to a variable
+ other -> "It is " <> int.to_string(other)
}
io.debug(result)
}