title: Swift exit IBAction func in if
body: <p>Im trying to end a funtion of an IBAction in an if statement, after validation input.</p>
  
  <p>I've made a (global) function to check if the values of the variables which contain user input are Integers. Im trying to exit the functon by returning nothing, but the function doesn't end.</p>
  
  <pre><code>@IBAction func calculate(sender: AnyObject) {
  var objects: [Int?] = [] // Contains an array of variables to be checked
  
      //Global.checkInt returns true if all the variables in the array are int
      //Global.throwLocalNot Global function to show a local notification
  
      if Global.checkInt(objects) == false{
          Global.throwLocalNot("Error", description: "Check your input!", viewController: self)
          return
      }
  
  // Code to be executed if all variables are integers
  ...
  }
  </code></pre>
  
  <p>This code works and throws a local notification if the input is not correct, but the return does not seem to work. What is the best way to stop a function from further execution?</p>