Rust Hello World
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!
0 條評論,你可以發表評論,我們會進行改進
