Created
December 12, 2014 12:46
-
-
Save mpfund/f113cac287b6ae4cab7c to your computer and use it in GitHub Desktop.
Read Line from stdin and check if vector contains
This file contains hidden or 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::io; | |
| fn main() { | |
| let modules : Vec<&str> = vec!("a","dust","c"); | |
| let m = modules.as_slice(); | |
| let mut reader = io::stdin(); | |
| let inp = reader.read_line().ok().expect("Failed to read line"); | |
| if m.contains(&inp.trim()){ | |
| println!("true"); | |
| } else { | |
| println!("false"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment