How to Read Program Arguments in Rust Posted in Polyglotbits on 10 of Aug, 2015

Rust reminds me of C in many ways. The program arguments include the program name at the first index, but unlike C you have to make a function call to get the options. let args: Vec<_> = env::args().collect();

use std::env;

fn main() {
    let args: Vec<_> = env::args().collect();
    for arg in args.iter().skip(1) {
        println!("Hello {}", arg);


Because this vector is a high level construct (and not a lowlevel array like in c) you have high level ways to handle the data as well. In this case it means that we can skip the first entry (the program name) by calling skip on the iterator. Result in this for a hello world program: