Skip to content

Instantly share code, notes, and snippets.

@larryfox
Last active August 29, 2015 14:20
Show Gist options
  • Save larryfox/0d474c711e1373ec2ad2 to your computer and use it in GitHub Desktop.
Save larryfox/0d474c711e1373ec2ad2 to your computer and use it in GitHub Desktop.
yes(1) in Rust
use std::env;
fn main() {
let args: Vec<_> = env::args().skip(1).collect();
let yes = args.connect(" ");
if yes.is_empty() {
loop {
println!("y");
}
} else {
loop {
println!("{}", yes);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment