Created
September 28, 2014 09:19
-
-
Save Harinder/88af68577d1eb8e4bfc4 to your computer and use it in GitHub Desktop.
Variadic function arguments
This file contains 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 sumOf(numbers: Int...) -> Int { | |
var sum = 0 | |
for number in numbers { | |
sum += number | |
} | |
return sum | |
} | |
sumOf() | |
sumOf(42, 597, 12)” |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment