Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Rust: Ask your name
/* Ask the user for their name */
fn ask_name(prompt: ~str) -> ~str {
return io::stdin().read_line();
fn main() {
let name = ask_name(~"What is your name?");
println(fmt!("Hello %s", name));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment