In Chapter 1, Getting Started with Rust, we briefly introduced let, which is used to create new variable bindings—but let is more than that. In fact, let is a pattern-matching statement. Pattern matching is a construct mostly seen in functional languages such as Haskell and allows us to manipulate and make decisions about values based on their internal structure or can be used to extract values out of algebraic data types. We had already
let a = 23;let mut b = 403;
Our first line is let in its simplest form and it declares an immutable variable binding, a. In the second line, we have mut after the let keyword for b . mut is part of the let pattern, which binds b mutably to i32 types in this case. mut enables b to bind again ...