What output will be produced by the code below?

func greet(var name: String) {
    name = name.uppercased()
    print("Greetings, \(name)!")


Correct answer: This code will not compile.

Explanation: The greet() method declares its name parameter using the var keyword, which was allowed only in old versions of Swift. From Swift 3.0 onwards this construction is no longer valid, so the compiler will refuse to build this code.



© 2017