Hello Rust

  • Code
    • 主函数 main
      • 声明 fn
    • 语句结尾 ;
    • macro
      • println! 打印文本
// main 没有参数、没有返回值、是每个rust可执行程序最新运行的代码
fn main() {
    // 打印文本
    // println! 属于 Rust macro 宏定义
    // 正常来说函数是没有 感叹号的
    println!("Hello World");
}
  • Compile
    • ahead-of-time 先编译后执行
    • rustc 编译
      • rustc 原文件名
      • 尽适合简单几个文件的编译
$ rustc hello-world.rs
$ ls
hello-world    hello-world.rs
  • Run
$ ./hello-world
Hello World
明天我们吃什么 悲哀藏在现实中 Tacks
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!