Grow a plant label
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.
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.
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.