title: Array index out of Range in Swift
body: <p>Hi i am trying to print elements of array in reverse order but i am getting error like </p>
  
  <blockquote>
    <p>Array index out of Range.</p>
  </blockquote>
  
  <p>Can u guys help me out? I am posting my code below</p>
  
  <pre><code>import UIKit
  
  class DecimalToBinaryViewController: UIViewController {
  
  
  @IBOutlet weak var textField: UITextField!
  
  @IBOutlet weak var result: UILabel!
  
  
  @IBAction func binaryNumber(sender: AnyObject)
  {
      var myArray = [Int]()
       var number = textField.text.toInt()
      var num = Int(number!) // for converting optional Int? to Int
      var remainder:Int
     var condition = false
      while condition == false
      {
          remainder = num % 2
          myArray += [remainder]
          num /= 2
          if num == 0
          {
           condition = true
          }
      }
     var size = myArray.count
      for var i = size; i &gt;= 0; i--
      {
       println( myArray[i])
      }
  
  
  }
  </code></pre>