Variables

Basic Rust variables are created using this formula:

  1. The let keyword
  2. A name
  3. The = sign
  4. The value
  5. A ; character

The values for a string of text looks like this: String::from("apple"). Using that and alfa for the name we can create a variable like this:

let alfa = String::from("apple");

In Rust, setting variables is called "binding". So, the above line binds a String with the text "apple" to the variable alfa.