Rust 0.12.0 ダウンロード、Mozillaのプログラミング言語

ダウンロード
提供元サイトからダウンロード(source)
提供元サイトからダウンロード(windows)
提供元サイトからダウンロード(linux)
提供元サイトからダウンロード(OS X)

サンプルコード:

// This code is editable and runnable!
fn main() {
// A simple integer calculator:
// `+` or `-` means add or subtract by 1
// `*` or `/` means multiply or divide by 2

let program = “+ + * – /";
let mut accumulator = 0i;

for token in program.chars() {
match token {
'+’ => accumulator += 1,
'-' => accumulator -= 1,
'*’ => accumulator *= 2,
'/’ => accumulator /= 2,
_ => { /* ignore everything else */ }
}
}

println!(“The program \"{}\" calculates the value {}",
program, accumulator);
}

OpenSource

Posted by arkgame