Tour of Rust Table of Contents


A function has zero or more parameters.

In this example, the add function takes two arguments of type i32 (signed integer of 32-bit length).

If you just want to return an expression, you can drop the return keyword and the semicolon at the end, as we did in the subtract function.

Function names are always in snake_case.

Hint: if you define a function, the data it accepts are called parameters. If you call that function and pass data to it, then it's called arguments.