1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-25 02:06:46 +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
3 changed files with 6 additions and 14 deletions

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 {