Thomas Wieczorek
3/4/2008 12:52:00 AM
On Mon, Mar 3, 2008 at 11:25 PM, F. Senault <fred@lacave.net> wrote:
> Le 3 mars 2008 =E0 22:46, John Pritchard-Williams a =E9crit :
>
>
> > As an aside: I think it was VB that used to let you do that missing
> > parameter thing...but its been a while since I saw that....
>
> Yes, definitely VB6.
>
VB.Net still supports it in Late Binding, not sure about Early
Binding, I have seen that in an PowerPoint automation example just a
few days ago, when I worked on an recent project. I think it gets than
the optional value.
I like the hashed solution more, than leaving an empty space, between
two commatas. IMO it's more beautiful. Named parameters in Ruby 1.9
look also nice.
On Mon, Mar 3, 2008 at 10:36 PM, Jason Roelofs <jameskilton@gmail.com> wrot=
e:
>
> def aProc(options =3D {})
> a =3D options[:a] || 5
> b =3D options[:b] || 6
> c =3D options[:c] || 7
> print a, b, c
> end
>
You could also do like that:
def aProc(options =3D {})
options =3D {:a =3D> 5, :b =3D> 6, :c =3D> 7}.merge(options)
print options[:a], options[:b], options[:c]
end