Skip to content

Instantly share code, notes, and snippets.

@fabb
Created December 16, 2015 11:21
Show Gist options
  • Save fabb/2b0d390e077b130927cc to your computer and use it in GitHub Desktop.
Save fabb/2b0d390e077b130927cc to your computer and use it in GitHub Desktop.
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