Last active
September 10, 2016 18:48
-
-
Save suraphanL/46151f2da1d501652ceed6c52a576dad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func convertArray(array: [Int]) -> [String]? { | |
// Nothing to do. Exiting. | |
guard array.count > 0 else { return nil} | |
// Things to convert. | |
var stringArray = [String]() | |
for int in array { | |
let string = "\(int)" | |
stringArray.append(string) | |
} | |
return stringArray | |
} | |
let intArray = [0, 1, 2, 3, 4] | |
let convertedInts = convertArray(intArray) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment