GCGrowCarrer

Strings and Formatting

Locked

Lesson 3 of 25 · Syntax · Easy

Finish these first:Variables and Primitive Types →Or pass the tests below to unlock it now.

1

The big idea

A string holds text in Rust — words, names, or messages. Wrap your text in double quotes "...", assign it with let, and finish the line with a semicolon ;: Strings are case-sensitive, so "Hello" and "hello" are different values.

Think of it like this: Think of a Rust string like words printed on a card — double quotes show where the text starts and stops.
Key words (tap to learn):
2

Read the lesson

A string holds text in Rust — words, names, or messages.

Wrap your text in double quotes "...", assign it with let, and finish the line with a semicolon ;:

let city = "Tokyo";
let name = "Maya";
let note = "Welcome!";

Strings are case-sensitive, so "Hello" and "hello" are different values.

3

Quick check

How do you store the word "Tokyo" inside a Rust variable named city?

4

Your challenge

2 sample tests, 1 hidden

Inside main(), create a variable named greeting holding "Hello" (type let greeting = "Hello";).

Stuck? Get a hint (free)
More learning tools(compare languages, visual guide, related lessons)

Compare with another language

Similar to python.strings (86% overlap). UTF-8 string manipulation: template literals in JS, std::string in C++, immutable strings in Go, &str/String in Rust.

Visual walkthrough

A diagram, a step-by-step animation, and short captions for Strings and Formatting.

Mastery0%

Learn this first

Opens up next

This is the last lesson in this branch.