Default values for handler parameters
mwieder at ahsoftware.net
Sun Dec 8 15:27:58 EST 2013
Sunday, December 8, 2013, 10:51:44 AM, you wrote:
> How is what you wrote not accomplished by the following?
> command myCommand p1
> local p2="abc"
> -- more stuff
> end myCommand
> Maybe I'm missing what you're proposing, but I'm not seeing an immediate
> use for it. Thanks for explaining.
The idea is to provide for default values for optional parameters. In
your example, p2 would always be "abc". If you wanted to override
that, you couldn't. In the example below, p2 would be "abc" unless you
specified a p2 parameter in the calling line
command myCommand p1, p2="abc"
-- more stuff
put p2 after msg
myCommand "Scott" -- p2 is "abc"
myCommand "Scott", "Rossi" -- p2 is "Rossi"
ahsoftware at gmail.com
More information about the Use-livecode