Last active
September 23, 2015 05:16
-
-
Save romainmenke/267125e39598988c4df0 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
import UIKit | |
var myArray = [[1],[2,2],[3,3,3]] | |
func getElementCount(array array_I : [AnyObject]) -> Int { | |
var elementCount = 0 | |
guard let nestedArray = array_I as? [[AnyObject]] else { | |
return array_I.count | |
} | |
for nest in nestedArray { | |
elementCount += getElementCount(array: nest) | |
} | |
return elementCount | |
} | |
getElementCount(array: myArray) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment