WolframLang: Global Variable

By Xah Lee. Date: . Last updated: .
Set[x, y]

🔸 SHORT SYNTAX: x=y

make x to have value y

Effectively, this is how you create a global variable.

Set

💡 TIP: builtin variable and function names start with an Uppercase letter. You should have your variable and function names starting in lower case.

Technically, Set creates a syntax transformation rule. When the pattern on left-hand-side occur, replace it by right-hand-side. [see Set, SetDelayed]

(* global variable, of current session  *)
x = 2
Clear[sym1, sym2, etc]

Clear the value of Symbols.

Clear

Clear[x]

(* clear multiple variables *)
Clear[x1,x2]

(* clear all variable starting with x *)
Clear["x*"]
Remove

Remove Symbols from the system. Note: this is more advanced. Usually you just need Clear.

Remove

WolframLang: Variable