Complete the code to assign the value 5 to variable x using an expression.
let x = [1];The value 5 is an expression that can be assigned to x. The other options are invalid statements or syntax errors.
Complete the code to print the sum of 3 and 4 using an expression inside println! macro.
println!("{}", [1]);
The expression '3 + 4' calculates the sum and can be used inside println!. The other options are invalid syntax or misuse of macros.
Fix the error by replacing the blank with a valid expression that returns 10.
let y = [1];The expression '10' is a valid value to assign. 'let 10' is invalid syntax, 'return 10' is a statement used inside functions, and 'println!' is a macro that returns ().
Complete the code to create a block expression that returns 15.
let z = { { let a = 10; a {BLANK_2}} 5 };The block expression starts with '{' and the expression 'a + 5' returns 15. Using '-' would give 5, and '(' is invalid here.
Fill both blanks to create a block expression that returns the uppercase of a string slice.
let s = "hello";
let result = { { s.{BLANK_2}}().{{BLANK_2}}() };The block starts with '{'. The method 'to_uppercase()' converts the string slice to uppercase, then 'to_string()' converts it to a String. Using '(' is invalid here.
