Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9c39b05

Browse files
committed
Add array exercise from @ruipserra!!! πŸŽ†πŸŽ†πŸŽ†
Connects to rust-lang#29.
1 parent 7780a35 commit 9c39b05

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Create an array with at least 100 elements in it where the ??? is.
2+
// Scroll down for hints!
3+
4+
fn main() {
5+
let a = ???
6+
7+
if a.len() >= 100 {
8+
println!("Wow, that's a big array!");
9+
} else {
10+
println!("Meh, I eat arrays like that for breakfast.");
11+
}
12+
}
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
39+
40+
// There's a shorthand to initialize Arrays with a certain size that does not
41+
// require you to type in 100 items (but you certainly can if you want!)
42+
// Check out the Primitive Types -> Arrays section of the book:
43+
// http://doc.rust-lang.org/stable/book/primitive-types.html#arrays
44+
// Bonus: what are some other things you could have that would return true
45+
// for `a.len() >= 100`?

0 commit comments

Comments
Β (0)