Created
December 16, 2015 11:21
-
-
Save fabb/2b0d390e077b130927cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct Song { | |
let title: String | |
let length: Float | |
func withAddedAdvertisement() -> Song { | |
return Song(title: self.title + " plus commercial", length: self.length + 10) | |
} | |
} | |
let song1 = Song(title: "Aerials", length: 240) | |
let song2 = song1.withAddedAdvertisement() | |
print(song2.length) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment