Codebase list ohcount / dfcc369c-a8fa-4697-8331-c0472835aae2/main test / src_dir / rust.rs
dfcc369c-a8fa-4697-8331-c0472835aae2/main

Tree @dfcc369c-a8fa-4697-8331-c0472835aae2/main (Download .tar.gz)

rust.rs @dfcc369c-a8fa-4697-8331-c0472835aae2/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]);
        }
    }
}