Files
2026-02-24 17:37:07 +08:00

844 B

A Basic Calculator

In this section 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.


Task

Introduction task is to complete the intro function. The function should return the string: I'm ready to build a calculator in Rust!