title: Swift function returning two different types
body: <p>I need a function that can return either a <code>String</code> or an <code>Int</code> depending on the parameters entered eg:</p>
  
  <pre><code>func getValue (type: String) -&gt; (String || Int) {  //this line is obviously wrong
      if type == "type1" {
          return "exampleString"
      }
      else if type == "type2"
          return 56
      }
  }
  </code></pre>