mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 14:02:22 -05:00
Merge pull request #733 from apogeeoak/intro
feat(intro): Proposal to add successfully compiling exercise as the first exercise.
This commit is contained in:
commit
4cde788d33
5 changed files with 58 additions and 6 deletions
8
exercises/intro/README.md
Normal file
8
exercises/intro/README.md
Normal 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)
|
23
exercises/intro/intro1.rs
Normal file
23
exercises/intro/intro1.rs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
// 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#" |___/ "#);
|
||||||
|
println!();
|
||||||
|
println!("This exercise compiles successfully. The remaining exercises contain a compiler");
|
||||||
|
println!("or logic error. The central concept behind Rustlings is to fix these errors and");
|
||||||
|
println!("solve the exercises. Good luck!");
|
||||||
|
}
|
9
exercises/intro/intro2.rs
Normal file
9
exercises/intro/intro2.rs
Normal 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 {}!");
|
||||||
|
}
|
|
@ -1,10 +1,6 @@
|
||||||
// variables1.rs
|
// variables1.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables1` if you want a hint :)
|
// Make me compile!
|
||||||
|
// Execute the command `rustlings hint variables1` if you want a hint :)
|
||||||
// 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.
|
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
16
info.toml
16
info.toml
|
@ -1,3 +1,19 @@
|
||||||
|
# INTRO
|
||||||
|
|
||||||
|
[[exercises]]
|
||||||
|
name = "intro1"
|
||||||
|
path = "exercises/intro/intro1.rs"
|
||||||
|
mode = "compile"
|
||||||
|
hint = """
|
||||||
|
Remove the I AM NOT DONE comment to move on to the next exercise."""
|
||||||
|
|
||||||
|
[[exercises]]
|
||||||
|
name = "intro2"
|
||||||
|
path = "exercises/intro/intro2.rs"
|
||||||
|
mode = "compile"
|
||||||
|
hint = """
|
||||||
|
Add an argument after the format string."""
|
||||||
|
|
||||||
# VARIABLES
|
# VARIABLES
|
||||||
|
|
||||||
[[exercises]]
|
[[exercises]]
|
||||||
|
|
Loading…
Reference in a new issue