-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
8b94790
commit 135e5d4
Showing
4 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
### Option | ||
|
||
#### Book Sections | ||
|
||
To learn about Option<T>, check out these links: | ||
|
||
- [Option Enum Format](https://doc.rust-lang.org/stable/book/ch10-01-syntax.html#in-enum-definitions) | ||
- [Option Module Documentation](https://doc.rust-lang.org/std/option/) | ||
- [Option Enum Documentation](https://doc.rust-lang.org/std/option/enum.Option.html) |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//option1.rs | ||
//Make me compile! Execute `rustlings hint option1` for hints | ||
|
||
//I AM NOT DONE | ||
|
||
//you can modify anything EXCEPT for this function's sig | ||
fn print_number(maybe_number: Option<u16>) { | ||
println!("printing: {}", *maybe_number); | ||
} | ||
|
||
fn main() { | ||
print_number(13); | ||
print_number(99); | ||
|
||
let mut numbers: [Option<u16>; 5]; | ||
for iter in 0..5 { | ||
let number_to_add: u16 = { | ||
((iter * 5) + 2) / (4 * 16); | ||
}; | ||
|
||
numbers[iter] = number_to_add; | ||
} | ||
} |
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