Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Variables/GAP/variables.gap
Normal file
24
Task/Variables/GAP/variables.gap
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# At top level, global variables are declared when they are assigned, so one only writes
|
||||
global_var := 1;
|
||||
|
||||
# In a function, local variables are declared like this
|
||||
func := function(n)
|
||||
local a;
|
||||
a := n*n;
|
||||
return n + a;
|
||||
end;
|
||||
|
||||
# One can test whether a variable is assigned
|
||||
IsBound(global_var);
|
||||
# true;
|
||||
|
||||
# And destroy a variable
|
||||
Unbind(global_var);
|
||||
|
||||
# This works with list elements too
|
||||
u := [11, 12, , 14];
|
||||
IsBound(u[4]);
|
||||
# true
|
||||
IsBound(u[3]);
|
||||
# false
|
||||
Unbind(u[4]);
|
||||
Loading…
Add table
Add a link
Reference in a new issue