SKILL global variables

Guest
Hi,

Is there in SKILL something like global variable and if yes how it is
assigned?

Thanks,
Sonia
 
On Jul 10, 10:35 am, s_kouchl...@yahoo.com wrote:
Hi,

Is there in SKILL something like global variable and if yes how it is
assigned?

Thanks,
Sonia
I'm no expert, but I've been using "defvar," as in: (defvar
THEwidgetprecision 0.36)

Edward
 
On Tue, 10 Jul 2007 20:34:33 -0700, Edward <edward.dodge@gmail.com> wrote:

On Jul 10, 10:35 am, s_kouchl...@yahoo.com wrote:
Hi,

Is there in SKILL something like global variable and if yes how it is
assigned?

Thanks,
Sonia

I'm no expert, but I've been using "defvar," as in: (defvar
THEwidgetprecision 0.36)

Edward
No particular need to do this using defvar. In SKILL, all variables are
global unless you declare them as local (using let(), prog() etc) or they are
implicitly local (e.g. loop variables in foreach, exists, mapcar etc).

So in C syntax, just doing:

MYglobalVar=10

will do this. In LISP syntax, this would be:

(setq MYglobalVar 10)

You can use defvar, but be aware that it doesn't guarantee to make it
global - for example, if you do:

(let (a) (defVar a 10) a)

then this will return 10, and the variable a will be undefined after the code
exist. "a" already exists in the scope, and so that is what defVar binds to.

Regards,

Andrew.
--
Andrew Beckett
Senior Solution Architect
Cadence Design Systems, UK.
 
On Jul 10, 10:24 pm, Andrew Beckett <andr...@DcEaLdEeTnEcTe.HcIoSm>
wrote:
On Tue, 10 Jul 2007 20:34:33 -0700, Edward <edward.do...@gmail.com> wrote:
On Jul 10, 10:35 am, s_kouchl...@yahoo.com wrote:
Hi,

Is there in SKILL something like global variable and if yes how it is
assigned?

Thanks,
Sonia

I'm no expert, but I've been using "defvar," as in: (defvar
THEwidgetprecision 0.36)

Edward

No particular need to do this using defvar. In SKILL, all variables are
global unless you declare them as local (using let(), prog() etc) or they are
implicitly local (e.g. loop variables in foreach, exists, mapcar etc).

So in C syntax, just doing:

MYglobalVar=10

will do this. In LISP syntax, this would be:

(setq MYglobalVar 10)

You can use defvar, but be aware that it doesn't guarantee to make it
global - for example, if you do:

(let (a) (defVar a 10) a)

then this will return 10, and the variable a will be undefined after the code
exist. "a" already exists in the scope, and so that is what defVar binds to.

Regards,

Andrew.
--
Andrew Beckett
Senior Solution Architect
Cadence Design Systems, UK.
Thanks for the good explanation.

Sonia
 

Welcome to EDABoard.com

Sponsor

Back
Top