Post Reply 
No way to get an element free of brackets
02-17-2021, 05:02 PM
Post: #6
RE: No way to get an element free of brackets
(02-17-2021 10:48 AM)Didier Lachieze Wrote:  Here is a simplified way to use lists to assign values to global variables, not requiring CAS ...

FYI, assignment via expr() might assign to local variable instead, if it exist.

EXPORT test()
BEGIN
local a := 123;
expr("a := 456");
return a;
end;

CAS> test()
456
CAS> a
a

Compared to Python, which can easily assign global variables.
(OTTH, this might not be a good thing ...)

>>> def test(): a = 123; globals()['a'] = 456; return a
...
>>> test()
123
>>> a
456
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: No way to get an element free of brackets - Albert Chan - 02-17-2021 05:02 PM



User(s) browsing this thread: 1 Guest(s)