Re: dealing with arguments [message #71118] |
Wed, 02 June 2010 15:12  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
Use keywords instead of positional arguments:
pro name, mode, s1=s1, s2=s2
That way, when calling the routine you can use any order, or omit any
argument, and they still get associated to the right variables. Also
consider replacing s1 and s2 by more descriptive names, to make it
easier for users to know what the arguments mean. With keywords, you
can still use the short names inside your routine:
pro name, mode, some_argument_name_1=s1, some_other_argument=s2
|
|
|
Re: dealing with arguments [message #71267 is a reply to message #71118] |
Wed, 02 June 2010 15:17  |
fgg
Messages: 67 Registered: April 2010
|
Member |
|
|
On Jun 2, 3:12 pm, pp <pp.pente...@gmail.com> wrote:
> Use keywords instead of positional arguments:
>
> pro name, mode, s1=s1, s2=s2
>
> That way, when calling the routine you can use any order, or omit any
> argument, and they still get associated to the right variables. Also
> consider replacing s1 and s2 by more descriptive names, to make it
> easier for users to know what the arguments mean. With keywords, you
> can still use the short names inside your routine:
>
> pro name, mode, some_argument_name_1=s1, some_other_argument=s2
Thank you, pp. So if mode=2 and I want to make s2=100 then all I need
is:
proname, 2, s2=100 ?
|
|
|