aboutsummaryrefslogtreecommitdiff
path: root/src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam')
-rw-r--r--src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam b/src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam
index e58659a..df7a6f9 100644
--- a/src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam
+++ b/src/content/chapter1_functions/lesson04_anonymous_functions/code.gleam
@@ -7,6 +7,11 @@ pub fn main() {
// Pass an anonymous function as an argument
io.debug(twice(1, fn(a) { a * 2 }))
+
+ let secret_number = 42
+ // This anonymous function always returns 42
+ let secret = fn() { secret_number }
+ io.debug(secret())
}
fn twice(argument: Int, my_function: fn(Int) -> Int) -> Int {