Skip to content

Commit 0338b1c

Browse files
committed
primitive_types3 solution
1 parent e105172 commit 0338b1c

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
// Create an array with at least 100 elements in it where the ??? is.
2-
31
fn main() {
4-
let a = ???
2+
// TODO: Create an array with at least 100 elements in it where the ??? is.
3+
// let a = ???
54

65
if a.len() >= 100 {
76
println!("Wow, that's a big array!");
87
} else {
98
println!("Meh, I eat arrays like that for breakfast.");
10-
panic!("Array not big enough, more elements needed")
9+
panic!("Array not big enough, more elements needed");
1110
}
1211
}

rustlings-macros/info.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ name = "primitive_types3"
250250
dir = "04_primitive_types"
251251
test = false
252252
hint = """
253-
There's a shorthand to initialize Arrays with a certain size that does not
253+
There's a shorthand to initialize arrays with a certain size that doesn't
254254
require you to type in 100 items (but you certainly can if you want!).
255255
256256
For example, you can do:
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
1+
fn main() {
2+
// An array with 100 elements of the value 42.
3+
let a = [42; 100];
4+
5+
if a.len() >= 100 {
6+
println!("Wow, that's a big array!");
7+
} else {
8+
println!("Meh, I eat arrays like that for breakfast.");
9+
panic!("Array not big enough, more elements needed");
10+
}
11+
}

0 commit comments

Comments
 (0)