- Open a Text Editor (Notepad/Notepad++/TextEdit or Sublime based on your OS).
- Write the following to it.
fn main() { println!("Hello World!"); } - Save the file as main.rs

Steps to Run the "Hello World!" Rust Program
- Open Terminal (if on Mac/Linux/Ubuntu) or Command Prompt (if on Windows)
- Move to the location where you have created the main.rs file.
- Run the command: rustc main.rs to compile our "Hello World!" program.
rustc main.rs - Finally, we are good to run our program,
./main
Output:

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!