[Top][All Lists]

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

Re: global variables

From: Christoph Dalitz
Subject: Re: global variables
Date: Mon, 24 May 2004 15:25:47 +0200

On Mon, 24 May 2004 08:09:58 -0500
"Dan Eriksson" <address@hidden> wrote:
> I have version 2.1.50 and can't bring global variables into functions. This 
> is what I get:
> global x = 1
> isglobal("x")
> ans = 1
> function test
> isglobal("x")
> y=x+1
> endfunction
Declare x in the function as global too. There is another trap concerning the
initialization of global variables: the assignment only works in the first 
declaration, so that it is safer to set your variable x with

        global x
        x = 1


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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