Variadic Functions | Go by Example - Swift 3.0

Variadic functions can be called with any number of trailing arguments. Same like print(...) for Swift. Can be used with define type e.g. "String, Int.." or Any protocol.

/// variadic
func variadic (any: Any...) {
    if any.isEmpty {

    for val in any {


variadic(any: "hello", "world", 2017, 2.0)

Post a Comment