[Solved] What is the use of the “of” keyword in Swift? [duplicate]


In this case, “of” is the label for the argument called “name”.

If you were to call this function, it would be

student(of: "Mathematics")

However inside the student function, you would get it’s value with “name”

func student(of name: String) -> String {

    print(name)

    // TODO: Do something and return

}

Just a suggestion, IMHO “of” is not very descriptive of what the function does or what “of” represents (is “of” an id? The name of the student?).

2

solved What is the use of the “of” keyword in Swift? [duplicate]