This website is for preparing the Korean translation and should NOT confused with the Official Rust Website!

Rust 是一种注重高效、安全、并行的系统程序语言。
详情...

推荐版本:
1.12.0 (source)
安装 下载其他版本

特点

// 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 = 0; 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); }
fn main() {
// 一个简易计算器
// `+` 或 `-` 意味着加减1
// `*` 或 `/` 意味着乘除2

let program = "+ + * - /";
let mut accumulator = 0;

for token in program.chars() {
match token {
    '+' => accumulator += 1,
    '-' => accumulator -= 1,
    '*' => accumulator *= 2,
    '/' => accumulator /= 2,
    _ => { /* 忽略其他 */ }
}
}

println!("程序 \"{}\" 的结果是 {}",
   program, accumulator);
}