Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise typos #362

Merged
merged 5 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions concepts/let-assertions/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn get_first_element_or_crash(items: List(e)) -> e {
}
```

Most the time in Gleam programs we want to handle every possible case, but in some programs such as prototypes and quick scripts we may want to focus only on the happy path and not write code for other cases. This is where Gleam's `let assert` comes in.
Most of the time in Gleam programs we want to handle every possible case, but in some programs such as prototypes and quick scripts we may want to focus only on the happy path and not write code for other cases. This is where Gleam's `let assert` comes in.

With let assertions a pattern can match only some of the possible values of a type, and if the pattern does not match a value the program will crash. Using `let assert` we can write the above function like this:

Expand All @@ -23,4 +23,4 @@ pub fn get_first_element_or_crash(items: List(e)) -> e {
}
```

Gleam libraries should never use let assertions as they can crash the program, instead they should use the `Result` type and let the application developer decide how to handle errors.
Gleam libraries should never use let assertions as they can crash the program. Instead, they should use the `Result` type and let the application developer decide how to handle errors.
4 changes: 2 additions & 2 deletions exercises/concept/spring-cleaning/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn get_first_element_or_crash(items: List(e)) -> e {
}
```

Most the time in Gleam programs we want to handle every possible case, but in some programs such as prototypes and quick scripts we may want to focus only on the happy path and not write code for other cases. This is where Gleam's `let assert` comes in.
Most of the time in Gleam programs we want to handle every possible case, but in some programs such as prototypes and quick scripts we may want to focus only on the happy path and not write code for other cases. This is where Gleam's `let assert` comes in.

With let assertions a pattern can match only some of the possible values of a type, and if the pattern does not match a value the program will crash. Using `let assert` we can write the above function like this:

Expand All @@ -25,4 +25,4 @@ pub fn get_first_element_or_crash(items: List(e)) -> e {
}
```

Gleam libraries should never use let assertions as they can crash the program, instead they should use the `Result` type and let the application developer decide how to handle errors.
Gleam libraries should never use let assertions as they can crash the program. Instead, they should use the `Result` type and let the application developer decide how to handle errors.
Loading