(Dagnabbed mailing list didn’t set the ReplyTo field! What’s up with that?)

> On Nov 7, 2014, at 8:57 AM, Charles Jenkins <cejw...@gmail.com> wrote:
> 
> It looks to me like Process.arguments[] does not return an optional value. I 
> think you need to find out how many elements are in the array before 
> attempting to access them by an index.
> 
> — 
> 
> Charles Jenkins

Sadly, that’s what I gather too. So it looks like there’s no way to work an 
array subscript into an optional chain, for safeguarding purposes.

Strangely, this new construction also fails, and for the same reason too:

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

“fatal error: Array index out of range”

I’m running it now from inside XCode, so there are no arguments; would that be 
a problem?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to