Skip to content

Commit 9008f26

Browse files
Add modifications from feedback
1 parent 938a348 commit 9008f26

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

courses/rust_essentials/040_control_flow_basics/03_match.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Using "match" as a Statement
2020
0 => {
2121
println!("Grumble");
2222
println!("Must protest");
23-
} // Comma is optional, unidiomatic
23+
} // Comma is optional here, usually omitted
2424
1 => {
2525
println!("Tail wag engaged")
26-
} // Block for single expression is optional, unidiomatic
27-
2 => println!("Maximum happiness"),
28-
_ => println!("Suspicion"), // Comma is optional, idiomatic
26+
} // Block is valid but unnecessary for one line
27+
2 => println!("Happiness!"), // Comma is REQUIRED here
28+
_ => println!("Suspicion"), // Trailing comma is allowed, idiomatic
2929
}
3030
3131
--------------------------------

courses/rust_essentials/040_control_flow_basics/06_functions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ What is a function?
77
---------------------
88

99
- Primary way to organize code into reusable blocks
10-
- Take inputs, process them, and (often) return a value
10+
- Take inputs, process them, and return a result (even if empty)
1111
- Declared using the :rust:`fn` keyword
1212
- Must be immediately followed by the body enclosed in :rust:`{ }`
1313
- Typically in **snake_case** (e.g., :rust:`calculate_area`)

0 commit comments

Comments
 (0)