Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SKILL global variables

1,094 views
Skip to first unread message

s_kou...@yahoo.com

unread,
Jul 10, 2007, 1:35:40 PM7/10/07
to
Hi,

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

Thanks,
Sonia

Edward

unread,
Jul 10, 2007, 11:34:33 PM7/10/07
to

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

Edward

Andrew Beckett

unread,
Jul 11, 2007, 1:24:33 AM7/11/07
to

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.

s_kou...@yahoo.com

unread,
Jul 11, 2007, 12:54:56 PM7/11/07
to
On Jul 10, 10:24 pm, Andrew Beckett <andr...@DcEaLdEeTnEcTe.HcIoSm>
wrote:

Thanks for the good explanation.

Sonia

0 new messages