File tree Expand file tree Collapse file tree 3 files changed +6
-14
lines changed
Expand file tree Collapse file tree 3 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,8 @@ use-boolean-and = true
233233'unsafe/extern-functions.html' = ' ../unsafe-rust/unsafe-functions.html'
234234'unsafe/unsafe-traits.html' = ' ../unsafe-rust/unsafe-traits.html'
235235'exercises/day-3/safe-ffi-wrapper.html' = ' ../../unsafe-rust/exercise.html'
236+ 'hello-world/hello-world.html' = ' ../types-and-values/hello-world.html'
237+ 'control-flow-basics/conditionals.html' = ' if.html'
236238
237239[output .exerciser ]
238240output-directory = " comprehensive-rust-exercises"
Original file line number Diff line number Diff line change 3030 - [ Exercise: Fibonacci] ( types-and-values/exercise.md )
3131 - [ Solution] ( types-and-values/solution.md )
3232- [ Control Flow Basics] ( control-flow-basics.md )
33- - [ Conditionals ] ( control-flow-basics/conditionals .md )
33+ - [ ` if ` Expressions ] ( control-flow-basics/if .md )
3434 - [ Loops] ( control-flow-basics/loops.md )
3535 - [ ` for ` ] ( control-flow-basics/loops/for.md )
3636 - [ ` loop ` ] ( control-flow-basics/loops/loop.md )
Original file line number Diff line number Diff line change 22minutes : 4
33---
44
5- # Conditionals
6-
7- Much of the Rust syntax will be familiar to you from C, C++ or Java:
8-
9- - Blocks are delimited by curly braces.
10- - Line comments are started with ` // ` , block comments are delimited by
11- ` /* ... */ ` .
12- - Keywords like ` if ` and ` while ` work the same.
13- - Variable assignment is done with ` = ` , comparison is done with ` == ` .
14-
15- ## ` if ` expressions
5+ # ` if ` expressions
166
177You use
188[ ` if ` expressions] ( https://doc.rust-lang.org/reference/expressions/if-expr.html#if-expressions )
@@ -21,8 +11,8 @@ exactly like `if` statements in other languages:
2111``` rust,editable
2212fn main() {
2313 let x = 10;
24- if x < 20 {
25- println!("small ");
14+ if x == 0 {
15+ println!("zero! ");
2616 } else if x < 100 {
2717 println!("biggish");
2818 } else {
You can’t perform that action at this time.
0 commit comments