rustlings

solving rustlings ft. dracuxan
git clone [email protected]:dracuxan/rustlings.git
Log | Files | Refs

primitive_types3.rs (435B)


      1 fn main() {
      2     // TODO: Create an array called `a` with at least 100 elements in it.
      3     let mut a: [usize; 100] = [1; 100];
      4     let mut i: usize = 1;
      5 
      6     while i < 100 {
      7         a[i] = i + 1;
      8         i += 1;
      9     }
     10 
     11     if a.len() >= 100 {
     12         println!("Wow, that's a big array!");
     13     } else {
     14         println!("Meh, I eat arrays like that for breakfast.");
     15         panic!("Array not big enough, more elements needed");
     16     }
     17 }