> On 10/06/10 23:37, Jussi Lahtinen wrote: > > I'm used to do this kind of things like this: > > > > Public Sub _new(Optional x As Float = -1, Optional y As Float = -1 > > ,Optional z As Float = -1) > > > > If x <> -1 Then v[0] = x > > If y <> -1 Then v[1] = y > > If z <> -1 Then v[2] = z > > > > End > > > > > > Jussi > > Thanks Jussi and everyone else who replied. > > My _new routine now looks like this and it does what it should do: > > ------------------ > Public Sub _new(Optional x As Float = 0, Optional y As Float = 0, > Optional z As Float = 0) > v[0] = x > v[1] = y > v[2] = z > End > ------------------ > Dirt simple, dirt cheap. > I don't need to test the parameters any more because 0 is the default > anyway. My problem was that I didn't know you need to specify Optional > for each and every parameter. Come to think of it it does make sense. > > Regards > Werner >
Actually you should have to only specify the first optional keyword, because as soon as one argument is optional, all the next are optional too. Regards, -- Benoît Minisini ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user