I'm just trying to cut my teeth on Swift here, and there are a few command-line activities I like to use to make sure I understand what a language is doing.
The goal in this case is to take a parameter from the command line, that may or may not have been entered with the command that started the program, and assign it to a variable for use. The "Nil Coalescing" operator (??) like the perfect construction: var inputValue = Process.arguments[1].toInt() ?? defaultValue And the preprocessor thought it looked good too. But at runtime, Xcode reports a "Fatal error: Array index out of range." Is this a bug in the preprocessor (for not flagging something that may not exist), the language itself (for failing to branch upon finding a non-existent value) or my understanding of the capabilities of the language (for trying to get it to do too much)? _______________________________________________ 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