Rullst AcademyRullst Academy/Lesson
Rust: first sparks · Lesson 02 / 06

Text or calculation?

The station received “2 + 3”. Is that a note to display or a calculation to solve? Quotes change the mission.

Learning paths6 min

Let's discover together

  1. 1

    "2 + 3" is text: Rust preserves those characters. But 2 + 3, without quotes, is a numeric expression that produces 5.

  2. 2

    In println!("{}", 2 + 3), {} reserves a place for the calculated value. The result fills that place. The braces do not appear in the output.

  3. 3

    Try all three cards. Read from the inside out: is there a calculation outside the quotes? What value fills the placeholder?

✦
YOUR MISSION

Predict the difference between displaying text and calculating an expression.

Now it's your turn

Discovery workshop

Three messages, two ideas

Compare each output with the code that produced it.
Mini experiment

Learning simulation: compare cards and check your predictions. The browser is not compiling Rust or starting a server.

fn main() { println!("2 + 3"); }
Build your answers and check when you are ready.
A moment to understand

Why does the first card not display 5?

I need a hint

Inside quotes, 2 + 3 is a message; outside them, the sum can be calculated.

Loading your journey…

Take it with you

Invent a shop sign containing numbers. Mark the fixed text and anything that would need calculating.

Show me the Rust behind it

This part is optional. You don't need to memorize the code to continue.

fn main() { println!("2 + 3"); println!("{}", 2 + 3); }
At your own pace

My files and GitHub

Every lesson can become your own record: code, notes or a practice plan. Saving a file to GitHub is optional and does not change your XP.

Student guide

The editor and downloads open when this lesson is available to your account. Check access below or return to the track map.

Checking your access to this lesson…

Rullstpetbot

AI can make mistakes. Check the lesson material.