Concatenation str with str
- In the example we have two strings hard-coded in the binary of our executable.
examples/strings/concatenation-str-with-str/src/main.rs
fn main() { let str1 = "Hello"; let str2 = "World"; // let text = str1 + str2; // cannot add `&str` to `&str` let text = str1.to_owned() + " " + str2; println!("{}", text); }
Hello World