Search⌘ K

Pairing and Nesting

Explore the concept of pairing and nesting special symbols in Rust such as parentheses, curly braces, and quotes. Learn how to properly match and close these symbols in the correct order to write valid and organized Rust programs, enhancing your understanding of Rust syntax and code structure.

We'll cover the following...

A lot of Rust involves lots of special symbols. Let’s look at our “Hello, world!” program again:

Rust 1.40.0
fn main() {
println!("Hello, world!");
}

We have the left parenthesis, (, right parenthesis, ), left curly brace, {, right curly brace, }, semicolon ;, and double quotes, ". Ignore the ...