...

/

The Basic Formatting

The Basic Formatting

This lesson will teach you how to format a statement in Rust in different ways.

In the previous lesson, we saw how we could print a string to the console. But what if we want to print strings in a particular format? Rust can help by using placeholders.

Note: In Rust, we cannot directly print numbers or variables within the println!() macro, unlike other languages. We need a placeholder {}.

Single Placeholder

A single placeholder is used when it is required ...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy