使用编辑器编写我们的第一个rust代码
创建一个名为:hello.rs 的文件
fn main() {
// println打印到控制台
println!("Hello World!");
}
使用rustc编译成可执行的二进制文件
rustc hello.rs
执行运行
./hello
控制台输出
代码注释
// 单行注释
// Line comments which go to the end of the line.
/* 多行注释 */
/* Block comments which go to the closing delimiter. */
扩展
使用VScode编译器时可安装插件rust-analyzer直接Run code即可,无需编译