mirror of https://github.com/rust-lang/rustlings
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
656 B
Rust
48 lines
656 B
Rust
// primitive_types3.rs
|
|
// 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!).
|
|
// For example, you can do:
|
|
// let array = ["Are we there yet?"; 10];
|
|
|
|
// Bonus: what are some other things you could have that would return true
|
|
// for `a.len() >= 100`?
|