[Swift-user] Is there a way to have an optional command line argument to a swift script?

Ben Clifford benc at hawaga.org.uk
Thu Apr 9 13:45:18 CDT 2009


On Thu, 9 Apr 2009, Glen Hocky wrote:

> I have a new command line argument for my script and I want to check if it's
> there or not.

You can have a default value for an argument. The user guide describes 
how.

If you choose a sufficiently obscure default value, you can pretty much 
detect if you got the default value or not and change behaviour based on 
it. Or if you only want to know if its there or not in order to assign a 
default value you get that automatically.

-- 




More information about the Swift-user mailing list