So I have this simple program that uppercases the string passed,
fn main() {
let string = String::from("test here");
let result = test(&string);
println!("{}", &result);
}
fn test(param: &String) -> String {
let upper = param.to_uppercase();
return upper;
}
Now what I don't understand is if I should use param
or ¶m
inside test
function body. string
is already passed as a reference so should I use just param.to_uppercase()
or does it still make sense to reference the param itself so something like ¶m.to_uppercase()
?