Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

SKILL global variables

瀏覽次數:1,094 次
跳到第一則未讀訊息

s_kou...@yahoo.com

未讀,
2007年7月10日 下午1:35:402007/7/10
收件者:
Hi,

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

Thanks,
Sonia

Edward

未讀,
2007年7月10日 晚上11:34:332007/7/10
收件者:

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

Edward

Andrew Beckett

未讀,
2007年7月11日 凌晨1:24:332007/7/11
收件者:

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

未讀,
2007年7月11日 中午12:54:562007/7/11
收件者:
On Jul 10, 10:24 pm, Andrew Beckett <andr...@DcEaLdEeTnEcTe.HcIoSm>
wrote:

Thanks for the good explanation.

Sonia

0 則新訊息