title: What is the correct type to use for an array index?
body: <p>This code works, but I want to explicitly declare the type of the index range <code>max</code>. However <code>uX</code> or <code>iX</code>, where X = 8, 16 or 32 gives compile errors. What is the correct type?</p>
  
  <pre><code>fn main() {
      let mut arr2: [[f64; 3]; 3] = [[0.0; 3]; 3];
      let pi: f64 = 3.1415926535;
  
      let max = 3; // let max: i16 e.g. is wrong
  
      for ii in 0..max {
          for jj in 0..3 {
              let i = ii as f64;
              let j = jj as f64;
              arr2[ii][jj] = ((i + j) * pi * 41.0).sqrt().sin();
              println!("arr2[{}][{}] is {}", ii, jj, arr2[ii][jj]);
          }
      }
  }
  </code></pre>