Re: Nil Coalescing and Optional Chaining?
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