Core Beginner

00  Variables

Rust bindings are immutable unless you say otherwise, and constants carry an explicit type.

Step 1 / 3

Make total mutable so with_bonus can add the bonus and return the new score.

Hints
  • let is immutable by default -- add mut to reassign.
00_variables.rs
Reset to starterCompiled in a sandbox; hidden checks must pass.
Reveal solution
fn with_bonus(score: i32, bonus: i32) -> i32 {
    let mut total = score;
    total = total + bonus;
    total
}