title: Swift: Prime Number app: Variable initialisation
body: <p>Im quite new to programming, so hopefully someone can explain this to me in plain english.. 
  Im trying to build an app in Swift that tells you wether the number inputted is a prime number or not. If it isn't prime, it should also tell you the factors of the numbers, e.x. if the user inputs 6, it tells you that 6 isn't a prime number, and apart from being divisible by 0, 1 and itself, its also divisible by 2 and 3. The code written until now is as follows:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
      @IBOutlet weak var textField: UITextField!
      @IBOutlet weak var outputMessage: UILabel!
      @IBAction func checkButton(sender: AnyObject) {
  
          var isPrime = true
          var inputNumber = textField.text.toInt()
          var multiples:Int
  
  
          if (inputNumber != nil) {
  
              if (inputNumber &lt;= 0) {
  
                  outputMessage.text = "Neither 0 nor negative numbers are considered prime numbers!"
                  textField.resignFirstResponder()
  
              } else {
  
                  if (inputNumber == 1) {
  
                      outputMessage.text = "1 isn't a prime number!"
                      textField.resignFirstResponder()
  
                  }
                  else {
  
                      for var i = 2; i &lt; inputNumber; ++i {
  
                          if (inputNumber! % i == 0) {
  
                              // Number is not prime
                              isPrime = false
                              multiples = i
  
                          }   
                      }
                  }
  
                  if (isPrime == true) {
  
                      outputMessage.text = "Yup, that's a prime number!"
                      textField.resignFirstResponder()
  
                  } else {
  
                      outputMessage.text = "That number isn't prime. Apart from 1, 0 and itself, the number is also divisible by \(multiples) "
                      textField.resignFirstResponder()
  
                  }
              }
  
          } else {
  
              outputMessage.text = "Please enter a number!"
              textField.resignFirstResponder()
  
          }
  
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
  }
  </code></pre>
  
  <p>Towards the end, where the output message says "That isn't a prime. Apart from 0, 1 and itself, the number is divisible by (multiples)"
  The code crashed here - it says Variable 'multiples' used before being initialized.
  Can anyone help?</p>
  
  <p>Thanks a lot!!</p>