• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Swift question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Swift question


  • Subject: Swift question
  • From: David Delmonte <email@hidden>
  • Date: Wed, 04 Jun 2014 21:11:39 +0300

As there does not seem to be any appropriate place for this question, I’m guessing to post this here:

I’m starting through the enjoyable Guided Tour of Swift :(https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html#//apple_ref/doc/uid/TP40014097-CH2-XID_1)

and have a simple question…

        let nails = 100
        var hammers = 1

        

        let hammerTitle = " hammers"
        if hammers == 1  {
            let hammerTitle = " hammer"
        }
        let toolSummary = "I have \(nails) nails and \(hammers)" + hammerTitle

This always results in:

toolSummary: I have 100 nails and 1 hammers

Any ideas what I’m doing wrong?
(for non-english speakers, I want “1 hammer”)

Thanks


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Swift question
      • From: Alexandra Beebe <email@hidden>
    • Re: Swift question
      • From: Scott Ribe <email@hidden>
    • Re: Swift question
      • From: iseecolors <email@hidden>
References: 
 >swift and objective-c (From: "McLaughlin, Michael P." <email@hidden>)
 >Re: swift and objective-c (From: Roland King <email@hidden>)
 >Re: swift and objective-c (From: Ron Hunsinger <email@hidden>)
 >Re: swift and objective-c (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: swift and objective-c
  • Next by Date: Re: Swift question
  • Previous by thread: Re: swift and objective-c
  • Next by thread: Re: Swift question
  • Index(es):
    • Date
    • Thread