How to return a Range of Int in Swift? -
how can return range of int function in swift? i've searched swift 2.1 docs, web, so, , tried:
func myfunc() -> range { // } func myfunc() -> ( int ... int ) { // } func myfunc() -> range< int > { // }
... , many others ...
sorry being bone-headed here, , in advance!
your third 1 correct. compiles , works, example:
func oneto10() -> range<int> { return 1...10 }
Comments
Post a Comment