title: How to use for loop to create Int array in Swift 3
body: <p>I know this is a very basic question,</p>
  
  <p>But I try lot methods, and always show:</p>
  
  <blockquote>
    <p>"fatal error: Array index out of range"</p>
  </blockquote>
  
  <p>I want to create a 0~100 int array </p>
  
  <p>e.q. var integerArray = [0,1,2,3,.....,100]</p>
  
  <p>and I trying</p>
  
  <pre><code>var integerArray = [Int]()
  for i in 0 ... 100{
  integerArray[i] = i
  }
  </code></pre>
  
  <p>There are also appear : fatal error: Array index out of range</p>
  
  <p>Thanks for help</p>
  
  <p>Complete code:</p>
  
  <pre><code>class AlertViewController: UIViewController,UIPickerViewDelegate, UIPickerViewDataSource {
  
  @IBOutlet weak var integerPickerView: UIPickerView!
  @IBOutlet weak var decimalPickerView: UIPickerView!
  
  var integerArray = [Int]()
  var decimalArray = [Int]()
  
  override func viewDidLoad() {
      super.viewDidLoad()
      giveArrayNumber()
      integerPickerView.delegate = self
      decimalPickerView.delegate = self
      integerPickerView.dataSource = self
      decimalPickerView.dataSource = self
  }
  
  func giveArrayNumber(){
      for i in 0 ... 100{
          integerArray[i] = i
      }
  }
  </code></pre>