In this lesson we’ll create our first “Hello World” Rust program from scratch and will learn how to compile it using rustc.
Instructor: Start by creating a file main.rs and create a function main() using the fn keywords. This is the function that will be run when we execute our program. To output "Hello, World" we use println!, or print line, which takes a string. We give it "Hello, World." Then we save the file.
Next, we compile the program using the rustc compiler. Once that is done, we'll see that there is a new file called main, which can be executed straight from the command line.
You must be a Pro Member to view code
Access all courses and lessons, track your progress, gain confidence and expertise.