Complete the code to assign 10 to x if condition is true, otherwise 5.
let x = if condition [1] 10 else 5;
The if–else expression in Rust uses braces {} to enclose the blocks of code for each condition.
Complete the code to assign the larger of a and b to max using if–else expression.
let max = if a > b [1] a else b;
In Rust, the if and else blocks must be enclosed in braces to form an expression.
Fix the error in the if–else expression to correctly assign a value to result.
let result = if number % 2 == 0 [1] "even" else "odd";
Rust requires braces around the blocks in if–else expressions, even for single expressions.
Complete the code to create a conditional expression that assigns 'positive' or 'non-positive' to status.
let status = if number {BLANK_1}} 0 { "positive" else "non-positive";
The condition uses > to check if number is greater than zero, and braces to group the true block.
Fill all three blanks to assign a grade based on score using nested if–else expressions.
let grade = if score >= 90 [1] "A" else if score >= 80 [2] "B" else [3] "C";
Each if and else if block must be enclosed in braces to form valid Rust expressions.