PR3-Rust-SS26/D-ownership/example-code/02-ownership/mutable-string.rs

8 lines
172 B
Rust

fn main() {
let mut s1 = String::from("hello");
s1.push_str(", world!"); // appending the literal to s
println!("{s1}"); // this will print `hello, world!`
}