Skip to content

Instantly share code, notes, and snippets.

@Thesephi
Last active November 8, 2024 01:58
Show Gist options
  • Save Thesephi/bc6c833f5d47360eee34f7ddb1603f75 to your computer and use it in GitHub Desktop.
Save Thesephi/bc6c833f5d47360eee34f7ddb1603f75 to your computer and use it in GitHub Desktop.
a simple function written in rust
pub fn main(name: &str) -> String {
let mut ret_val = String::from("xin chào, ");
ret_val.push_str(name);
println!("{}", ret_val);
ret_val
}
// normally `main` isn't supposed to return `String` type
// but this is done on purpose here to support a specially intended use case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment