Variables
Basic Rust variables are created using this formula:
- The
let
keyword - A name
- The
=
sign - The value
- 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
.