cargo new foo-app --bin
--bin
: a binary project. cargo build
let answer = 42; // always 42 let mut maybe = 9; // can be changed (is mutable)
$ echo 'fn main() {println!("xyz")}' | rustc - -o a.out
camelCase
should have a snake case name: fn camelCase() { println!("warning: function `camelCase` should have a snake case name") } fn main() { camelCase() }
fn snake_case() { println!("function with snake case") } fn main() { snake_case() }
// xyz /* bla bla bla */
/// Commenting the following item: //! Commenting the enclosing item.
$ echo 'fn main() {break rust}' | rustc - -o a.out … error: internal compiler error: It looks like you're trying to break rust; would you like some ICE? …