From 6547082733888e8545a42a4e14a089dc88994141 Mon Sep 17 00:00:00 2001
From: Giacomo Cavalieri
- To fix the code change the code to call the
-
- io.debug
-
- function instead, as it will print a value of any type.
+ If you need to debug print something you can use the echo
+ keyword instead, as it will print a value of any type.
Gleam has no null
, no implicit conversions, no exceptions, and
diff --git a/src/content/chapter0_basics/lesson16_blocks/en.html b/src/content/chapter0_basics/lesson16_blocks/en.html
index b19c586..1541bb2 100644
--- a/src/content/chapter0_basics/lesson16_blocks/en.html
+++ b/src/content/chapter0_basics/lesson16_blocks/en.html
@@ -7,11 +7,8 @@
Any variables assigned within the block can only be used within the block.
- Try uncommenting
-
- io.debug(degrees)
-
- to see the compile error from trying to use a variable that is not in scope.
+ Try uncommenting echo degrees
to see the compile error from
+ trying to use a variable that is not in scope.
Blocks can also be used to change the order of evaluation of binary operators diff --git a/src/content/chapter1_functions/lesson07_pipelines/code.gleam b/src/content/chapter1_functions/lesson07_pipelines/code.gleam index 5156cb1..07ae4ef 100644 --- a/src/content/chapter1_functions/lesson07_pipelines/code.gleam +++ b/src/content/chapter1_functions/lesson07_pipelines/code.gleam @@ -8,12 +8,14 @@ pub fn main() { // With the pipe operator "Hello, Mike!" |> string.drop_right(1) + |> echo |> string.drop_left(7) |> io.println // Changing order with function capturing "1" |> string.append("2") + |> echo |> string.append("3", _) |> io.println } diff --git a/src/content/chapter1_functions/lesson07_pipelines/en.html b/src/content/chapter1_functions/lesson07_pipelines/en.html index 783ade9..927f9a8 100644 --- a/src/content/chapter1_functions/lesson07_pipelines/en.html +++ b/src/content/chapter1_functions/lesson07_pipelines/en.html @@ -23,3 +23,7 @@ position then a function capture can be used to insert the argument to the desired position.
+
+ If you need to debug print a value in the middle of a pipeline you can use
+ |> echo
to do it.
+
io.println
- or
-
- io.debug
-
- will be shown in the bottom section, along with any compile errors and warnings.
+ or echo
will be shown in the bottom section, along with any compile
+ errors and warnings.
To evaluate Gleam code the tour compiles Gleam to JavaScript and runs it,
all entirely within your browser window.