title |
---|
Getting Started |
Let's go through the process of installing Rust on your system and being able to compile your first program.
Head over to Rust's homepage and download the nightly version of Rust for your operating system. This should be a simple, one-click install.
Now that Rust is installed, you'll have access to the rustc
executable. That's the Rust compiler.
Let's create a new file called hello_world.rs
. The Rust file extension, if you didn't know already, is rs
.
// hello_world.rs
fn main() {
println!("Hello World!");
}
Now you can compile it with:
$ rustc hello_world.rs -o helloworld
Let's run the hello world program written in Rust:
$ ./helloworld
Hello World!