Codebase list ohcount / c865d4db-f4b2-4b3e-8e76-e6475c6514d2/main test / src_dir / rust.rs
c865d4db-f4b2-4b3e-8e76-e6475c6514d2/main

Tree @c865d4db-f4b2-4b3e-8e76-e6475c6514d2/main (Download .tar.gz)

rust.rs @c865d4db-f4b2-4b3e-8e76-e6475c6514d2/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]);
        }
    }
}