Codebase list ohcount / 4fa67836-5fea-4473-87e4-bd80a2d5b1ae/main test / src_dir / rust.rs
4fa67836-5fea-4473-87e4-bd80a2d5b1ae/main

Tree @4fa67836-5fea-4473-87e4-bd80a2d5b1ae/main (Download .tar.gz)

rust.rs @4fa67836-5fea-4473-87e4-bd80a2d5b1ae/mainraw · history · blame

/*
 * This is the example given by www.rust-lang.org
 */
// Line comments work too
fn main() {
    let nums = [1, 2];
    let noms = ["Tim", "Eston", "Aaron", "Ben"];
 
    let mut odds = nums.iter().map(|&x| x * 2 - 1);
 
    for num in odds {
        do spawn {
            println!("{:s} says hello from a lightweight thread!", noms[num]);
        }
    }
}