daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for arg in std::env::args().skip(2)
  2.    
  3. let check: Vec<String> = env::args().collect();
  4.  
  5. if check[1] == 'sort'{
  6.     for arg in std::env::args().skip(2){
  7.        //sort
  8.     }
  9. }
  10.    
  11. let second_arg = env::args().nth(1).expect("no second arg");
  12.    
  13. let mut args = env::args();
  14. match args.nth(1).as_ref().map(|s| s.as_str()) {
  15.     // args has been consumed so it will iterate over the next elements
  16.     Some("sort") => for arg in args {
  17.         println!("arg: {}", arg);
  18.     },
  19.     _ => {},
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top