help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: named arguments


From: Olaf Till
Subject: Re: named arguments
Date: Fri, 16 Mar 2012 12:53:04 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

On Fri, Mar 16, 2012 at 12:21:19PM +0100, Juan Pablo Carbajal wrote:
> Hi,
> Looks like named arguments are still positional
> 
> function namedarg (a,b='named b',c='named c')
>  disp(b);
>  disp(c);
> end
> 
> > namedarg(1)
> named b
> named c
> > namedarg(1,b=0)
> 0
> named c
> > namedarg(1,c=0)

What you pass as second argument is just the value of the assignment
"c=0", which is "0", no matter whether you call the variable assigned
to "c" or something else.

I'm not aware of Octave supporting named arguments. There was once a
suggestion to support named arguments, but it has been disapproved
because of the risk of future incompatibilities with Matlab.

Olaf

> 0
> named c
> 
> I expected the second call to return
> 
> named b
> 0
> 
> or I am getting something wrong?
> 
> -- 
> M. Sc. Juan Pablo Carbajal
> -----
> PhD Student
> University of Zürich
> http://ailab.ifi.uzh.ch/carbajal/
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]