Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: calucaltor args

Implement a calculator for the 4 basic operations (+, -, /, *) in Rust that accepts the parameters on the command line:

rustc calc.rs
./calc 3 + 4
7

./calc 3 - 4
-1
  • You should not use the rust.sh for this!
  • What's going on with multiplication?