Last active
August 29, 2015 14:20
-
-
Save larryfox/0d474c711e1373ec2ad2 to your computer and use it in GitHub Desktop.
yes(1) 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
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