From a1c22e954299de5c823ec47cd2f633355764e3b2 Mon Sep 17 00:00:00 2001
From: Dimitrii Dulgher
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
All gleam code is in some module or other, whose name comes from the
- name of the file it's in. For example,
For code in one module to access code in another module, we import it using
the
The gleam/io
module contains a variety of functions
- for printing, like println
.
+ For example, the
+
+ gleam/io
+
+ module contains a variety of functions for printing, like
+
+ println
+ .
gleam/io
is in a file
- called io.gleam
in a directory called gleam
.
+ name of the file it's in. For example,
+
+ gleam/io
+
+ is in a file called io.gleam
in a directory called gleam
.
import
keyword, and the name used to refer to it is the last
- part of the module name. For example, the gleam/io
module is
- referred to as io
once imported.
+ part of the module name. For example, the
+
+ gleam/io
+
+ module is referred to as io
once imported.
as
keyword can be used to refer to a module by a different
- name. See how the gleam/string
module is referred to as
- text
here.
+ name. See how the
+
+ gleam/string
+
+ module is referred to as text
here.
io.println("Hello!")
.
+
+ io.println("Hello!")
+ .
It is also possible to specify a list of functions to import from a module in diff --git a/src/content/chapter0_basics/lesson04_type_checking/en.html b/src/content/chapter0_basics/lesson04_type_checking/en.html index a9316c4..0cffcbe 100644 --- a/src/content/chapter0_basics/lesson04_type_checking/en.html +++ b/src/content/chapter0_basics/lesson04_type_checking/en.html @@ -3,12 +3,22 @@ code, catching mistakes and showing you where to make changes.
- Uncomment the line io.println(4)
and see how a compile time error
- is reported as the io.println
function only works with strings,
- not ints.
+ Uncomment the line
+
+ io.println(4)
+
+ and see how a compile time error
+ is reported as the
+
+ io.println
+
+ function only works with strings, not ints.
- To fix the code change the code to call the io.debug
+ To fix the code change the code to call the
+
+ io.debug
+
function instead, as it will print a value of any type.
diff --git a/src/content/chapter0_basics/lesson05_ints/en.html b/src/content/chapter0_basics/lesson05_ints/en.html index 252496a..41793d5 100644 --- a/src/content/chapter0_basics/lesson05_ints/en.html +++ b/src/content/chapter0_basics/lesson05_ints/en.html @@ -9,9 +9,9 @@ JavaScript's 64 bit floating point numbers,
- The
- gleam/int
+ The
+
+ gleam/int
+
standard library module contains functions for working with ints.
- The
- gleam/float
+ The
+
+ gleam/float
+
standard library module contains functions for working with floats.
\u{xxxxxx}
- unicode codepoint
- The gleam/string
+ The
+
+ gleam/string
+
standard library module contains functions for working with strings.
- The gleam/bool
+ The
+
+ gleam/bool
+
standard library module contains functions for working with bools.
Like functions types can be referred to in a qualified way by putting
- the imported module name and a dot before the type name. For example,
- bytes_builder.BytesBuilder
+ the imported module name and a dot before the type name. For example,
+
+ bytes_builder.BytesBuilder
+
Types can also be imported in an unqualified way by listing them in diff --git a/src/content/chapter0_basics/lesson16_blocks/en.html b/src/content/chapter0_basics/lesson16_blocks/en.html index bc82e39..b19c586 100644 --- a/src/content/chapter0_basics/lesson16_blocks/en.html +++ b/src/content/chapter0_basics/lesson16_blocks/en.html @@ -7,8 +7,11 @@ 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
+
+ io.debug(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/chapter0_basics/lesson17_lists/en.html b/src/content/chapter0_basics/lesson17_lists/en.html index c29758a..84f88f3 100644 --- a/src/content/chapter0_basics/lesson17_lists/en.html +++ b/src/content/chapter0_basics/lesson17_lists/en.html @@ -2,9 +2,11 @@ Lists are ordered collections of values.
- List
is a generic type, having a type parameter
- for the type of values it contains. A list of ints has the type
- List(Int)
, and a list of strings has the type
+
+ List
+
+ is a generic type, having a type parameter for the type of values it contains.
+ A list of ints has the type List(Int)
, and a list of strings has the type
List(String)
.
-- cgit v1.2.3