From 04ec0d86c8b43d1cca48adc937b3e596a10577a1 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Tue, 26 Mar 2024 11:36:11 +0000 Subject: Improve introduction of modules and imports Thanks @RyanBrewer317! --- .../chapter0_basics/lesson02_modules/en.html | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/content/chapter0_basics/lesson02_modules/en.html (limited to 'src/content/chapter0_basics/lesson02_modules/en.html') diff --git a/src/content/chapter0_basics/lesson02_modules/en.html b/src/content/chapter0_basics/lesson02_modules/en.html new file mode 100644 index 0000000..ebfd8bc --- /dev/null +++ b/src/content/chapter0_basics/lesson02_modules/en.html @@ -0,0 +1,26 @@ +

+ Gleam code is organized into units called modules. A module is a + bunch of definitions (of types, functions, etc.) that seem to belong together. + For example, the + + gleam/io + + module contains a variety of functions for printing, like + println. +

+

+ All gleam code is in some module or other, whose name comes from the + name of the file it's in. For example, gleam/io is in a file + called io.gleam in a directory called gleam. +

+

+ For code in one module to access code in another module, we import it using + the import keyword, and the name used to refer to it is the last + part of the module name. For example, to import the + gleam/io module is referred to as io once imported. +

+

+ The as keyword can be used to refer to a module by a different + name. See how the gleam/string module is be referred to as + text here. +

-- cgit v1.2.3