aboutsummaryrefslogtreecommitdiff
path: root/src/content/chapter2_flow_control
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/chapter2_flow_control')
-rw-r--r--src/content/chapter2_flow_control/lesson01_case_expressions/code.gleam13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/content/chapter2_flow_control/lesson01_case_expressions/code.gleam b/src/content/chapter2_flow_control/lesson01_case_expressions/code.gleam
index 6e1ed46..aaa2208 100644
--- a/src/content/chapter2_flow_control/lesson01_case_expressions/code.gleam
+++ b/src/content/chapter2_flow_control/lesson01_case_expressions/code.gleam
@@ -2,9 +2,16 @@ import gleam/io
import gleam/int
pub fn main() {
- let result = case int.random(5) {
- 0 -> "It's zero!"
- other -> "It's " <> int.to_string(other)
+ let x = int.random(5)
+ io.debug(x)
+
+ let result = case x {
+ // Match specific values
+ 0 -> "Zero"
+ 1 -> "One"
+
+ // Match any other value
+ _ -> "Other"
}
io.debug(result)
}