In this lecture, we're going to talk about how to set up the infamous Hello World Program.
If you're new to programming, Hello World is just the industry standard.
First program you create to get your feet wet and make sure your environment is running properly.
It's just going to be a super simple program that will output hello world to the console.
All the code that I do throughout this course I will.
Push to get hub and I believe the link to this and the resources tab.
So the first thing that I want to do is show you an extension that I installed.
It is called Rust.
It'll be the first one you type in.
And the extensions marketplace.
Just type in rust and it'll be the first one version.
0.7.8 is what I have installed currently.
So the first thing that we're going to do is type cargo new.
Hello?
And what that did is that created us a new directory called Hello.
So what is cargo?
Cargo is Russ.
Compilation manager, package manager, which is kind of like Pip and Python.
And it is Russ's general purpose tool.
You can use cargo to start a new project, build and run your program, and also manage external libraries
that your code is going to depend on.
Inside this hello folder, you can see that we have a cargo dot tamil folder and all this holds is just
the metadata, which is just a fancier word for information.
For the package.
We will cover cargo a lot more in depth later on in this course.
So now if we look inside of the source folder, we see we have main RS.
Main is the.
File that is going to basically be the centerpiece to creating your binary.
So whatever is inside of main, that's going to be the entry point to running the program.
So what we can do is run is seed into hello and run cargo build.
So now we built the program and it generated a new file for us called Target.
And inside here we have a bunch of different folders that were created, but the main one is Hello Dot
XY, and that's going to be our executable.
So now we can run cargo run and it's going to automatically go in and run the executable for us.
And as you can see, we have outputted hello world to the console.
So congratulations on creating, building and running your first rust program.