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.

Revisions

  1. fabb created this gist Dec 16, 2015.
    14 changes: 14 additions & 0 deletions SongPoll4.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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)