Programming in Swift: Fundamentals, Episode 35: Introduction to Functions | raywenderlich.com

Learn how to write your own functions in Swift, and see for yourself how Swift makes them easy to use.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/28092971-programming-in-swift-fundamentals/lessons/35

A minor correction, but starting at 4:15, the video mentions that the following would result in an error, because grade cannot be modified:

func printPassStatus(grade: Int) {
    grade * 2
}

However, this doesn’t modify grade, it performs the multiplication and returns the result as a new value. I believe the example was supposed to be:

func printPassStatus(grade: Int) {
    grade *= 2
}

I could see this causing some confusion, so I wanted to mention it in case it tripped anyone up.

Thank you for the great tutorials!