aboutsummaryrefslogtreecommitdiff
path: root/src/content/chapter2_flow_control/lesson01_case_expressions/code.gleam
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2024-01-23 14:45:24 +0000
committerLouis Pilfold <louis@lpil.uk>2024-01-23 14:45:24 +0000
commite6480a96ca92d8de2d6b5be34b1d1a0bbbd84335 (patch)
treed8e8eb966ffef47b6d995de7e89348533aaabd08 /src/content/chapter2_flow_control/lesson01_case_expressions/code.gleam
parent1aa782ae22aa55d44ba4ed01ad447915dc7802cb (diff)
downloadtour-e6480a96ca92d8de2d6b5be34b1d1a0bbbd84335.tar.gz
tour-e6480a96ca92d8de2d6b5be34b1d1a0bbbd84335.zip
Correct mismatched code
Diffstat (limited to 'src/content/chapter2_flow_control/lesson01_case_expressions/code.gleam')
-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)
}