Skip to content

Instantly share code, notes, and snippets.

@kaushalvivek
Last active August 2, 2021 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaushalvivek/9f892892a189c53d3932c7285b850453 to your computer and use it in GitHub Desktop.
Save kaushalvivek/9f892892a189c53d3932c7285b850453 to your computer and use it in GitHub Desktop.
Rust Variables 1
let var = 5; // immutable variable, Rust guesses datatype
let varWithType:i32 = 5; // immutable variable, datatype specified
let mut mutableVar:i32 = 5; // mutable variable with datatype
let (varA, varB) = (10, 20); // Rust identifies patterns for variable assignment
const CONST_VAR:i32 = 9; // constant declaration, immutable, very fast, requires data-type specification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment