hello rust | rust | rust 技术论坛-大发黄金版app下载
- 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
                                
                            