Chapter 5: Common Programming Concepts

This chapter introduces fundamental programming concepts shared by most languages, illustrating how they function in Rust and drawing comparisons with C where relevant. We will cover keywords, identifiers, expressions and statements, core data types (including scalar types, tuples, and arrays), variables (focusing on mutability, constants, and statics), operators, numeric literals, arithmetic overflow behavior, performance aspects of numeric types, and comments.

While many concepts will feel familiar to C programmers, Rust’s handling of types, mutability, and expressions often introduces stricter rules for enhanced safety and clarity. We defer detailed discussion of control flow (like if and loops) and functions until after covering memory management, as these constructs frequently interact with Rust’s ownership model. Similarly, Rust’s struct and powerful enum types, along with standard library collections like vectors and strings, will be detailed in dedicated later chapters.