Add array exercise from @ruipserra!!! 🎆🎆🎆

Connects to #29.
This commit is contained in:
Carol (Nichols || Goulding) 2016-02-07 12:12:24 -05:00
parent 7780a3537a
commit 9c39b05bac
1 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,45 @@
// Create an array with at least 100 elements in it where the ??? is.
// Scroll down for hints!
fn main() {
let a = ???
if a.len() >= 100 {
println!("Wow, that's a big array!");
} else {
println!("Meh, I eat arrays like that for breakfast.");
}
}
// There's a shorthand to initialize Arrays with a certain size that does not
// require you to type in 100 items (but you certainly can if you want!)
// Check out the Primitive Types -> Arrays section of the book:
// http://doc.rust-lang.org/stable/book/primitive-types.html#arrays
// Bonus: what are some other things you could have that would return true
// for `a.len() >= 100`?