[Swift] function 1-3
iOS 2015. 7. 23. 23:50func average(#numbers:Int...)->Int{
var total = 0
for n in numbers {
total += n
}
return total / numbers.count
}
average(numbers: 13, 14, 235, 3)
average(numbers: 1,2,3,4,5,6,7)
'iOS' 카테고리의 다른 글
[Swift] Class 1-1 (inheritance, referance copy) (0) | 2015.07.25 |
---|---|
[Swift] function 1-4 (0) | 2015.07.23 |
[Swift] function 1-2 (0) | 2015.07.23 |
[Swift] function 1-1 (0) | 2015.07.23 |
Loops, Switch Statements, and Ranges in Swift (0) | 2015.07.23 |