Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. func testFunc<T>(option:Int) -> [T] {
  2. var result:[T] = []
  3.  
  4. switch option {
  5. case 1:
  6. let sampleString:String = "hello"
  7. result.append(sampleString)
  8. case 2:
  9. let sampleInt:Int = 23
  10. result.append(sampleInt)
  11. default:
  12. return result
  13. }
  14.  
  15. return result
  16. }
  17.  
  18. "cannot invoke append with an argument list of type '(String)',
  19. and
  20. "cannot invoke append with an argument list of type '(Int)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement