Section 1 - Instruction

Previously, we saw how to print multiple things on one line using placeholders, like:

println!("My favorite number is {}", 7)

Engagement Message

What was the exact output of that command?

Section 2 - Instruction

Sometimes, we want to save a piece of information to use later in our program. Think of it like putting something in a labeled box so you can find it easily when you need it.

Engagement Message

Does that idea make sense?

Section 3 - Instruction

In programming, these labeled boxes are called variables. We create a variable and give it a value using the let keyword and the equals sign (=).

For example: let message = "Hello again!";

Here, message is the variable name (the label on the box).

Engagement Message

What value did we store inside the message variable?

Section 4 - Instruction

Once you've stored something in a variable, you can use the variable's name wherever you would have used the value itself.

For instance:

Engagement Message

What do you think running these two lines would output?

Section 5 - Instruction
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal