diff options
author | Louis Pilfold <louis@lpil.uk> | 2024-01-18 20:37:36 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-01-18 20:37:36 +0000 |
commit | 36c767cf7058cca2c63f1a74161133f2492648e8 (patch) | |
tree | 6c9a5b76b9e8432c71166c38accae91670929d92 /src | |
parent | b89fc3c98f14dc6d36efe5c7fc8a44c9b79c1e7f (diff) | |
download | tour-36c767cf7058cca2c63f1a74161133f2492648e8.tar.gz tour-36c767cf7058cca2c63f1a74161133f2492648e8.zip |
Remove paragraph covered by previous lesson
Diffstat (limited to 'src')
-rw-r--r-- | src/content/chapter2_flow_control/lesson07_list_recursion/text.html | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/content/chapter2_flow_control/lesson07_list_recursion/text.html b/src/content/chapter2_flow_control/lesson07_list_recursion/text.html index 7f2351d..94e8152 100644 --- a/src/content/chapter2_flow_control/lesson07_list_recursion/text.html +++ b/src/content/chapter2_flow_control/lesson07_list_recursion/text.html @@ -1,22 +1,19 @@ <p> - Most commonly functions in the - <a href="https://hexdocs.pm/gleam_stdlib/gleam/list.html"><code>gleam/list</code></a> - module are used to iterate across a list, but at times you may prefer - to work with the list directly. + Most commonly functions in the + <a href="https://hexdocs.pm/gleam_stdlib/gleam/list.html" + ><code>gleam/list</code></a + > + module are used to iterate across a list, but at times you may prefer to work + with the list directly. </p> <p> - Gleam doesn't have a looping syntax, instead iteration is done through - recursion and pattern matching. -</p> -<p> The <code>[first, ..rest]</code> pattern matches on a list with at least one element, assigning the first element to the variable <code>first</code> and - the rest of the list to the variable <code>rest</code>. - By using this pattern and a pattern for the empty list <code>[]</code> a - function can run code on each element of a list until the end is reached. + the rest of the list to the variable <code>rest</code>. By using this pattern + and a pattern for the empty list <code>[]</code> a function can run code on + each element of a list until the end is reached. </p> <p> This code sums a list by recursing over the list and adding each int to a <code>total</code> argument, returning it when the end is reached. </p> - |