Skip to content

Commit 4cde788

Browse files
authored
Merge pull request #733 from apogeeoak/intro
feat(intro): Proposal to add successfully compiling exercise as the first exercise.
2 parents 9838892 + 9b8de65 commit 4cde788

File tree

5 files changed

+58
-6
lines changed

5 files changed

+58
-6
lines changed

exercises/intro/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Intro
2+
3+
Rust uses the `print!` and `println!` macros to print text to the console.
4+
5+
## Further information
6+
7+
- [Hello World](https://doc.rust-lang.org/rust-by-example/hello.html)
8+
- [Formatted print](https://doc.rust-lang.org/rust-by-example/hello/print.html)

exercises/intro/intro1.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// intro1.rs
2+
// About this `I AM NOT DONE` thing:
3+
// We sometimes encourage you to keep trying things on a given exercise, even
4+
// after you already figured it out. If you got everything working and feel
5+
// ready for the next exercise, remove the `I AM NOT DONE` comment below.
6+
// Execute the command `rustlings hint intro1` for a hint.
7+
8+
// I AM NOT DONE
9+
10+
fn main() {
11+
println!("Hello and");
12+
println!(r#" welcome to... "#);
13+
println!(r#" _ _ _ "#);
14+
println!(r#" _ __ _ _ ___| |_| (_)_ __ __ _ ___ "#);
15+
println!(r#" | '__| | | / __| __| | | '_ \ / _` / __| "#);
16+
println!(r#" | | | |_| \__ \ |_| | | | | | (_| \__ \ "#);
17+
println!(r#" |_| \__,_|___/\__|_|_|_| |_|\__, |___/ "#);
18+
println!(r#" |___/ "#);
19+
println!();
20+
println!("This exercise compiles successfully. The remaining exercises contain a compiler");
21+
println!("or logic error. The central concept behind Rustlings is to fix these errors and");
22+
println!("solve the exercises. Good luck!");
23+
}

exercises/intro/intro2.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// intro2.rs
2+
// Make the code print a greeting to the world.
3+
// Execute `rustlings hint intro2` for a hint.
4+
5+
// I AM NOT DONE
6+
7+
fn main() {
8+
println!("Hello {}!");
9+
}

exercises/variables/variables1.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// variables1.rs
2-
// Make me compile! Execute the command `rustlings hint variables1` if you want a hint :)
3-
4-
// About this `I AM NOT DONE` thing:
5-
// We sometimes encourage you to keep trying things on a given exercise,
6-
// even after you already figured it out. If you got everything working and
7-
// feel ready for the next exercise, remove the `I AM NOT DONE` comment below.
2+
// Make me compile!
3+
// Execute the command `rustlings hint variables1` if you want a hint :)
84

95
// I AM NOT DONE
106

info.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# INTRO
2+
3+
[[exercises]]
4+
name = "intro1"
5+
path = "exercises/intro/intro1.rs"
6+
mode = "compile"
7+
hint = """
8+
Remove the I AM NOT DONE comment to move on to the next exercise."""
9+
10+
[[exercises]]
11+
name = "intro2"
12+
path = "exercises/intro/intro2.rs"
13+
mode = "compile"
14+
hint = """
15+
Add an argument after the format string."""
16+
117
# VARIABLES
218

319
[[exercises]]

0 commit comments

Comments
 (0)