Rust Hello World

这是传统的Hello World程序的源代码(Rust语言看就是这个样子)。

// This is the main function
fn main() {
   // The statements here will be executed when the compiled binary is called
   // Print text to the console
    println!("Hello World!");
}
println! 是文本打印到控制台的一个宏。

可以用Rust编译器生成二进制文件: rustc.

$ rustc hello.rs
rustc 将会产生一个二进制文件 hello ,并可以被执行:

$ ./hello
Hello World!

联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2022

备案号:京ICP备15003423号-3