Variables

Summary

  • Variables assign data to a temporary memory location
    • Allows programmers to easily work with memory
  • Can be set to any value & type
  • Immutable by default, but can be mutable
    • Immutable: cannot be changed
    • Mutable: can be changed

Examples:

let two = 2;
let hello = "hello";
let j = 'j';
let my_half = 0.5;
let mut my_name = "Bill";
let quit_program = false;
let your_half = my_half;
Recap

  • Variables make it easier to work with data
  • Variables can be assigned to any value
    • This includes other variables
  • Immutable by default