• 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
Re: Nil Coalescing and Optional Chaining?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nil Coalescing and Optional Chaining?


  • Subject: Re: Nil Coalescing and Optional Chaining?
  • From: David Wood <email@hidden>
  • Date: Fri, 07 Nov 2014 10:34:08 -0500

> On Nov 7, 2014, at 9:36 AM, Charles Jenkins <email@hidden> wrote:
>
> Well, if you have only one argument, then arguments.count would be 1, but to get the argument, you’d ask for Process.arguments[0]. Arrays are zero-based.

D'oh. Well, that fixed it. The final result looks like this:

var inputValue = (Process.arguments.count > 1) ? Process.arguments[1].toInt()! : defaultValue

...and it runs properly in both in Xcode and as a command-line tool.

Only now does it occur to me that the place to post this would have been a Swift-dev mailing list. Is that even a thing? There doesn't seem to be one of those on lists.apple.com.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Nil Coalescing and Optional Chaining?
      • From: Kyle Sluder <email@hidden>
    • Re: Nil Coalescing and Optional Chaining?
      • From: Scott Ribe <email@hidden>
References: 
 >Nil Coalescing and Optional Chaining? (From: David Wood <email@hidden>)
 >Re: Nil Coalescing and Optional Chaining? (From: David Wood <email@hidden>)
 >Re: Nil Coalescing and Optional Chaining? (From: Charles Jenkins <email@hidden>)

  • Prev by Date: UITableView - distinguish selection from drill-down
  • Next by Date: Re: Nil Coalescing and Optional Chaining?
  • Previous by thread: Re: Nil Coalescing and Optional Chaining?
  • Next by thread: Re: Nil Coalescing and Optional Chaining?
  • Index(es):
    • Date
    • Thread