Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Parse a Number

Use match to parse the string "42" into an i32. Print the result if it succeeds, or an error message if it fails.

Expected output:

text
Parsed: 42

Hints:

  • Use "42".parse::<i32>()
  • Match on Ok(n) and Err(e)
rust
fn main() {
}