aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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)
}