> On Nov 7, 2014, at 9:36 AM, Charles Jenkins <cejw...@gmail.com> 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 (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