This website is for preparing the Korean translation and should NOT confused with the Official Rust Website!
Rust é uma linguagem de programação de sistemas
que roda incrivelmente rápido,
previne segmentation faults,
e garante segurança entre threads.
Mostre-me!
fn main() { // Uma calculadora simples de inteiros: // `+` or `-` significa somar ou subtrair 1 // `*` or `/` significa multiplicar ou dividir por 2 let programa = "+ + * - /"; let mut acumulador = 0; for simbolo in programa.chars() { match simbolo { '+' => acumulador += 1, '-' => acumulador -= 1, '*' => acumulador *= 2, '/' => acumulador /= 2, _ => { /* ignore todo o resto */ } } } println!("O programa \"{}\" gera o valor {}", programa, acumulador); }