Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Fix the Return

This function is supposed to return the result of doubling a number, but something is wrong with the return value. Can you fix it?

Expected output:

text
Double of 6 is 12

Hint: Look carefully at the last line of the function. In Rust, if you want to return a value as the last expression, it should not have a semicolon!

rust
fn double(n: i32) -> i32 {
n * 2;
}

fn main() {
println!("Double of 6 is {}", double(6));
}