Mathematica 9 is now available

Module

Usage

Module[{x, y, ... }, expr] specifies that occurrences of the symbols x, y, ... in expr should be treated as local.
Module[{x =  , ... }, expr] defines initial values for x, ... .


Notes

Module allows you to set up local variables with names that are local to the module.
Module creates new symbols to represent each of its local variables every time it is called.
Module creates a symbol with name xxx$nnn to represent a local variable with name xxx. The number nnn is the current value of $ModuleNumber.
• The value of $ModuleNumber is incremented every time any module is used.
• Before evaluating expr, Module substitutes new symbols for each of the local variables that appear anywhere in expr except as local variables in scoping constructs.
• Symbols created by Module carry the attribute Temporary.
• Symbols created by Module can be returned from modules.
• You can use Module[{vars}, body /; cond] as the right-hand side of a transformation rule with a condition attached.
Module has attribute HoldAll.
Module is a scoping construct (see Section A.3.8).
Module constructs can be nested in any way.
Module implements lexical scoping.
• New in Version 2.


Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.