1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-11-27 22:38:18 +02:00

feat(intro): Add intro section.

This commit is contained in:
apogeeoak
2021-04-24 13:15:34 -04:00
parent 6b6dc9dd48
commit 21c9f44168
5 changed files with 54 additions and 6 deletions

View File

@@ -0,0 +1,8 @@
# Intro
Rust uses the `print!` and `println!` macros to print text to the console.
## Further information
- [Hello World](https://doc.rust-lang.org/rust-by-example/hello.html)
- [Formatted print](https://doc.rust-lang.org/rust-by-example/hello/print.html)

19
exercises/intro/intro1.rs Normal file
View File

@@ -0,0 +1,19 @@
// intro1.rs
// About this `I AM NOT DONE` thing:
// We sometimes encourage you to keep trying things on a given exercise, even
// after you already figured it out. If you got everything working and feel
// ready for the next exercise, remove the `I AM NOT DONE` comment below.
// Execute the command `rustlings hint intro1` for a hint.
// I AM NOT DONE
fn main() {
println!("Hello and");
println!(r#" welcome to... "#);
println!(r#" _ _ _ "#);
println!(r#" _ __ _ _ ___| |_| (_)_ __ __ _ ___ "#);
println!(r#" | '__| | | / __| __| | | '_ \ / _` / __| "#);
println!(r#" | | | |_| \__ \ |_| | | | | | (_| \__ \ "#);
println!(r#" |_| \__,_|___/\__|_|_|_| |_|\__, |___/ "#);
println!(r#" |___/ "#);
}

View File

@@ -0,0 +1,9 @@
// intro2.rs
// Make the code print a greeting to the world.
// Execute `rustlings hint intro2` for a hint.
// I AM NOT DONE
fn main() {
println!("Hello {}!");
}