Color theme
0 day streak0 XPP1
RustLearn mode
MISSION 1 OF 1

Grow a plant label

0 XP earned
Rust track: MasterMission: BeginnerMutable bindingsOwned stringsString appending
Before you start this master track

Typed functions and collections. Be ready for ownership, moves, mutability, and enum matching.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 2 challenges
LEARN THE CONCEPT

Understand it, then try it.

A nursery label begins with a plant name and gains a care instruction. String owns growable text, unlike a borrowed string literal. Rust bindings are immutable by default, so mut allows this label to change. push_str appends a string slice to the existing String without replacing its earlier characters.

main.rs
fn main() {    let mut label = String::from("fern");    label.push_str("-shade");    println!("{}", label);}

Each mission is a complete independent Rust program using the standard library. Save as main.rs, compile with rustc main.rs, then run the resulting executable. Rust 2021 edition or later is suitable.

Track the values line by line. Predict the result before running this example in your own editor.