Hello World!
Part of the Fundamentals section of Coddy's Rust journey — lesson 2 of 75.
The "Hello World!" is a simple program that outputs Hello World! to the screen.
In Rust, we use println!() macro to print output to the console. Note that println! ends with ln — a lowercase letter l (as in "line"), not an uppercase I. The text to be printed is placed within double quotes and enclosed in parentheses.
Let's take a look at the "Hello World!" program in Rust:
fn main() {
println!("Hello World!");
}Challenge
BeginnerUse the code view to write a program that outputs Hello World!
Note that anything inside quotation marks is case sensitive. For example:
println!("Hello World!");println!("hello world!");are different things (notice the capital letters in the first line)
Cheat sheet
To print to the console in Rust, use the println!() macro. Text inside quotes is case sensitive:
fn main() {
println!("Hello World!");
}Try it yourself
fn main() {
}This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
4Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsComparison OperatorsString Comparison5Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 33Variables Part 2
Type DeclarationNaming ConventionsType InferenceRecap - Initialize VariablesType Casting9Loops
For Over SeriesWhile LoopBreakContinueNested LoopLoop LabelsInfinite LoopRecap - Dynamic Input