A Basic Calculator

In this chapter we'll learn how to use Rust as a calculator.
It might not sound like much, but it'll give us a chance to cover a lot of Rust's basics, such as:

  • How to define and call functions
  • How to declare and use variables
  • Primitive types (integers and booleans)
  • Arithmetic operators (including overflow and underflow behavior)
  • Comparison operators
  • Control flow
  • Panics

Nailing the basics with a few exercises will get the language flowing under your fingers. When we move on to more complex topics, such as traits and ownership, you'll be able to focus on the new concepts without getting bogged down by the syntax or other trivial details.

Exercise

The exercise for this section is located in 02_basic_calculator/00_intro