Skip to content

Instantly share code, notes, and snippets.

@avgerin0s
Forked from grahamking/ask_name.rs
Created May 5, 2013 17:09
Show Gist options
  • Save avgerin0s/5521424 to your computer and use it in GitHub Desktop.
Save avgerin0s/5521424 to your computer and use it in GitHub Desktop.
use core::io::println;
/* Ask the user for their name */
fn ask_name(prompt: ~str) -> ~str {
println(prompt);
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