Skip to content

环境安装 ​

hello world ​

  1. 新建 main.rs
  2. 输入如下代码
rs
fn main() {
  println!("hello world");
}
  1. 编译 & 运行
sh
# 编译
rustc ./main.rs

# 执行
./main # ./main.exe (on windows)

注释 ​

rs
fn main() {
  // 输出一个 hello world 到控制台
  println!("hello world")

  /*
  多行注释
  多行注释
  */
}

编程语言分类 ​

  • 动态类型与静态类型
  • 强类型 与 弱类型

  • 编译型与解释型

Released under the MIT License.