What Is the Difference Between const and static in Rust?

Use const for compile-time constants and static for global variables that persist for the program's lifetime.

Use const for compile-time constants evaluated at compile time, and static for global variables that live for the entire program duration. const values are inlined at every use site, while static values have a single memory address. Use static when you need a mutable global (with unsafe) or a reference to a single shared value.

const MAX_POINTS: u32 = 100_000;
static LANGUAGE: &str = "Rust";

fn main() {
    println!("{MAX_POINTS}");
    println!("{LANGUAGE}");
}