added some string methods and assume1, which takes ([]/[t]) or ([]/[t] string) and returns t. If the first argument passed is [] instead of [t], panics with the custom error message, if one was provided (string argument).

This commit is contained in:
Dummi26
2023-03-22 19:20:02 +01:00
parent 2a00d01812
commit 744f268bfd
3 changed files with 228 additions and 1 deletions

View File

@@ -100,7 +100,7 @@ A match arm consists of two consecutive statements: The condition statement foll
If the condition statement matches, the action statement will be executed. The matched value from the condition statement can be found in the variable we originally matched on, so it can be used in the action statement.
**These are the rules for matching:**
- The condition statement *does not match* if it returns **false** or **[]**
- The condition statement *does not match* if it returns **false**, **[]** or an error.
- If the condition statement returns a length 1 tuple [v], it will match and the matched value will be v. The condition statement can't return any tuple except [] and [v] to avoid confusion. To return a tuple, wrap it in a length-1 tuple: [[val_1, val_2, val_3]].
- Otherwise, the condition statement will match and the matched value will be whatever it returned.