rust 学习记录

参考链接:https://doc.rust-lang.org/book/ch01-02-hello-world.html

1 hello world

main.rs

fn main() {
    println!("Hello, world!");
}
rustc main.rs
./main
Hello, world!

The main function is special: it is always the first code that runs in every executable Rust program.

主函数就是main

Rust style is to indent with four spaces, not a tab.

rust的缩进是4个空格,tab不行。

println! calls a Rust macro.

! 是说调用了宏,和函数不一样的。

文章目录