I am currently learning Rust (mostly from scratch) and now I want to add two strings together and print them out. But that is not as easy as in other languages. Here's what I've done so far (also tested with print!
):
fn sayHello(id: str, msg: str) {
println!(id + msg);
}
fn main() {
sayHello("[info]", "this is rust!");
}
The error I get is a little bit weird.
error: expected a literal
--> src/main.rs:2:14
|
2 | println!(id + msg);
| ^^^^^^^^
How can I solve this so that [info] this is rust will be printed out?