Re: Swift question
Re: Swift question
- Subject: Re: Swift question
- From: Carl Leiby <email@hidden>
- Date: Wed, 04 Jun 2014 18:17:28 +0000 (UTC)
1. HammerTitle can't be changed because you used let.
2. You didn't change it in the if you defined a new constant in that scope.
On Wed, Jun 4, 2014 at 11:13 AM -0700, "David Delmonte"
<email@hidden> wrote:
As there does not seem to be any appropriate place for this question, I’m guessing to post this here:
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