Last active
November 8, 2024 01:58
-
-
Save Thesephi/bc6c833f5d47360eee34f7ddb1603f75 to your computer and use it in GitHub Desktop.
a simple function written in rust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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