One more thing about rust

You will hear me say the following words


  • value
  • mutable reference or mutable borrow
  • immutable reference or immutable borrow

This isn't something that as a JS dev you think about.


So what is a reference (probably heard the term)? What is a mutable reference? (probably never heard this)? (whiteboard)

















() is a unit

() is called "unit." Effectively it is "nothing" value.

if true {
    println!("foo");
}


// I could write this
// --v this has type ()
let foo = if true {
    println!("foo");
}