fn pass_str(s: &str) -> &str {
return s;
}
fn pass_string(s: String) -> String {
return s;
}
fn main() {
// using string literal
let test: &str = "Hello world!";
println!("{}", pass_str(test));
// using string object
let text: String = String::from("Goodbye world!");
println!("{}", pass_string(text));
}
To embed this project on your website, copy the following code and paste it into your website's HTML: