1 Some basics

This chapter covers

  • Introducing Rust
  • Using comments (putting human-readable hints in your code)
  • Some primitive types (simple numbers and other simple types)
  • Type inference (how Rust knows the type)
  • “Hello, World!” and printing
  • Declaring variables and code blocks
  • Shadowing (giving variables the same name)

This first chapter is as easy as Rust gets and has a bit of everything to get started. You’ll notice that even in Rust’s easiest data types, there’s a strong focus on the bits and bytes that make up a computer’s system. That means there’s quite a bit of choice, even in simple types like integers. You’ll also start to get a feel for how strict Rust is. If the compiler isn’t satisfied, your program won’t run! That’s a good thing—it ...

Get Learn Rust in a Month of Lunches now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.