=
)
Set
[expr, value] Set
can be used to give a symbol a value:
a = 3
a
An assignment like this creates an ownvalue:
OwnValues[a]
You can set multiple values at once using lists:
{a, b, c} = {10, 2, 3}
{a, b, {c, {d}}} = {1, 2, {{c1, c2}, {a}}}
d
Set
evaluates its right-hand side immediately and assigns it to
the left-hand side:
a
x = a
a = 2
x
Set
always returns the right-hand side, which you can again use
in an assignment:
a = b = c = 2;
a == b == c == 2
Set
supports assignments to parts:
A = {{1, 2}, {3, 4}};
A[[1, 2]] = 5
A
A[[;;, 2]] = {6, 7}
A
Set a submatrix:
B = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
B[[1;;2, 2;;-1]] = {{t, u}, {y, z}};
B