From 17d738a6932f95859104f0945c04f50ca574b029 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Tue, 23 Jan 2024 13:45:36 +0000 Subject: [PATCH] Correct other code --- .../lesson02_variable_patterns/code.gleam | 10 ++++------ 1 file 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) }