Skip to content

Commit

Permalink
doc: add resources for variable and data types (kamranahmedse#4948)
Browse files Browse the repository at this point in the history
Add links for variables and data types from The Book (Official docs)
  • Loading branch information
AgusVelez5 committed Jan 9, 2024
1 parent 52fdd8f commit d314f3d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Variables, Constants, and Data Types

In Rust, variables are declared using the `let` keyword. They are immutable by default, which means once a value is bound to a variable, it cannot be changed. If you want to make a variable mutable, the `mut` keyword is used. So, if you wanted to declare a mutable variable `x` and assign it the value `5`, you would write `let mut x = 5;`. Variables can also be patterned. By default in Rust, variables are block-scoped. Rust also supports several types of variable attributes.
In Rust, variables are declared using the `let` keyword. They are immutable by default, which means once a value is bound to a variable, it cannot be changed. If you want to make a variable mutable, the `mut` keyword is used. So, if you wanted to declare a mutable variable `x` and assign it the value `5`, you would write `let mut x = 5;`. Variables can also be patterned. By default in Rust, variables are block-scoped. Rust also supports several types of variable attributes.

Learn more from the following links:

- [Variables and Mutability](https://rust-book.cs.brown.edu/ch03-01-variables-and-mutability.html)
- [Data Types](https://rust-book.cs.brown.edu/ch03-02-data-types.html)

0 comments on commit d314f3d

Please sign in to comment.