Media thumbnail
Type extension & optional values
The Swift programming language allows a programmer to extend types, even existing built in types such as Int. Here, I've used the func keyword to declare a new function called carefullyDividedBy, which takes a second integer, which represents the denominator and optionally returns a result. If the denominator is zero, we return the Optional none, representing the lack of a value. If the denominator is anything other than zero, we return something, namely the original number divided by the denominator. 
00:00
00:00
Seek 10 seconds backwards
Play
Seek 10 seconds forward
Mute

Chapter 3: Activity 2

From Karen Bjork January 31st, 2018  

views comments
Policy

Faculty, staff, and students are required to read, understand and comply with the PSU Copyright Policy and all applicable law regarding materials uploaded to Kaltura. Failure to comply with law and PSU policy may result in individual liability.

This Policy can be found here.

Full Transcript File located below Media Player