help-octave
[Top][All Lists]
Advanced

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

Re: "Permanent" variables


From: Jordi Gutiérrez Hermoso
Subject: Re: "Permanent" variables
Date: Sat, 06 Feb 2016 20:30:52 -0500

On Wed, 2016-01-27 at 22:03 +0000, Sergei Steshenko wrote:
> Use functions returning constant values, e.g.
> 
> function s = lw()
>   s = "linewidth";
> 
> endfunction
> 
> and then call it as
> 
> lw()
> 
> instead of
> 
> lw

There's no need to use parens, btw. You can use just `lw`. In fact,
this is how all of Octave's "constants" are defined, such as pi, i, or
e. They are in fact all functions. They take optional arguments (see
e.g. `help pi`), but if you don't use parens, then they're just
functions called without any arguments.

- Jordi G. H.





reply via email to

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