Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language >
Defining Variables and Functions
The symbolic language paradigm of Mathematica takes the concept of variables and functions to a new level. In Mathematica a variable can not only stand for a value, but can also be used purely symbolically. And building on Mathematica's powerful pattern language, "functions" can be defined not just to take arguments, but to transform a pattern with any structure.
x=... set a variable
f[x_]:=... define a function that takes any single argument
    
Set (=) immediate assignment (right-hand side evaluated immediately)
SetDelayed (:=) delayed assignment (right-hand side evaluated only when used)
Unset (=.) unset a variable
Clear clear a function definition
    
Module, ... scope local variables
e;e;e (CompoundExpression) execute expressions in sequence
Attributes  ▪ Flat  ▪ Orderless  ▪ Listable  ▪ HoldFirst  ▪ Protected
TUTORIALS
MORE ABOUT
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team