-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3875e43
commit 276859e
Showing
1 changed file
with
3 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
# Options | ||
|
||
Type Option represents an optional value: every Option is either Some and contains a value, or None, and does not. | ||
Option types are very common in Cairo code, as they have a number of uses: | ||
Type **`Option`** represents an optional value: every **`Option`** is either **`Some`** and contains a value, or *`None`**, and does not. | ||
**`Option`** types are very common in Cairo code, as they have a number of uses: | ||
|
||
- Initial values | ||
- Return values for functions that are not defined over their entire input range (partial functions) | ||
- Return value for otherwise reporting simple errors, where None is returned on error | ||
- Return value for otherwise reporting simple errors, where **`None`** is returned on error | ||
- Optional struct fields | ||
- Optional function arguments | ||
|
||
## Further Information | ||
|
||
- [Option Implementation](https://book.cairo-lang.org/ch06-01-enums.html#the-option-enum-and-its-advantages) |