1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-01-12 23:48:27 +02:00

Remove tangential text from if slide (#1840)

This commit is contained in:
Nicole L 2024-02-23 08:53:26 -08:00 committed by GitHub
parent 099ca497f2
commit 5ecdddf9c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 14 deletions

View File

@ -233,6 +233,8 @@ use-boolean-and = true
'unsafe/extern-functions.html' = '../unsafe-rust/unsafe-functions.html'
'unsafe/unsafe-traits.html' = '../unsafe-rust/unsafe-traits.html'
'exercises/day-3/safe-ffi-wrapper.html' = '../../unsafe-rust/exercise.html'
'hello-world/hello-world.html' = '../types-and-values/hello-world.html'
'control-flow-basics/conditionals.html' = 'if.html'
[output.exerciser]
output-directory = "comprehensive-rust-exercises"

View File

@ -30,7 +30,7 @@
- [Exercise: Fibonacci](types-and-values/exercise.md)
- [Solution](types-and-values/solution.md)
- [Control Flow Basics](control-flow-basics.md)
- [Conditionals](control-flow-basics/conditionals.md)
- [`if` Expressions](control-flow-basics/if.md)
- [Loops](control-flow-basics/loops.md)
- [`for`](control-flow-basics/loops/for.md)
- [`loop`](control-flow-basics/loops/loop.md)

View File

@ -2,17 +2,7 @@
minutes: 4
---
# Conditionals
Much of the Rust syntax will be familiar to you from C, C++ or Java:
- Blocks are delimited by curly braces.
- Line comments are started with `//`, block comments are delimited by
`/* ... */`.
- Keywords like `if` and `while` work the same.
- Variable assignment is done with `=`, comparison is done with `==`.
## `if` expressions
# `if` expressions
You use
[`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:
```rust,editable
fn main() {
let x = 10;
if x < 20 {
println!("small");
if x == 0 {
println!("zero!");
} else if x < 100 {
println!("biggish");
} else {