Created
December 16, 2015 11:12
-
-
Save fabb/e72a58a175f84d68937b 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 { | |
var title: String | |
var length: Float | |
mutating func addAdvertisement() { | |
self.title += " plus commercial" | |
self.length += 10 | |
} | |
} | |
var song = Song(title: "Aerials", length: 240) | |
song.addAdvertisement() | |
print(song.length) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
or even more functional: https://gist.github.com/fabb/2b0d390e077b130927cc