From baa7139462cfdbbe2df55bd14ef011cad2ae2387 Mon Sep 17 00:00:00 2001 From: Dane Sabo Date: Wed, 14 May 2025 16:08:22 -0400 Subject: [PATCH] vault backup: 2025-05-14 16:08:22 --- .../Chapter 3 - Common Programming Concepts.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Programming/Rust/Chapter 3 - Common Programming Concepts.md b/Programming/Rust/Chapter 3 - Common Programming Concepts.md index 13ef6e4d8..9f37d245a 100644 --- a/Programming/Rust/Chapter 3 - Common Programming Concepts.md +++ b/Programming/Rust/Chapter 3 - Common Programming Concepts.md @@ -166,3 +166,20 @@ I can use this multiple line comment */ ``` # 3.5 Control Flow +## `if` Statements +If statements in Rust are expressions, that optionally have else and else if +statements. + +```Rust +if number > 5 { + println!("Yay!") +} else if number < 4{ + println!("Boo!") +} else { + println!("Just right!") +} +``` +Conditions for if statements *must* return Boolean types. + +## Repetition with Loops +