OwnValues
Details and Options
- Ownvalues are definitions for the symbol appearing on its own.
- You can specify the ownvalues for x by making an assignment of the form OwnValues[x]=list.
- The list returned by OwnValues has elements of the form HoldPattern[lhs]:>rhs.
Examples
open all close allBasic Examples (1)
Scope (3)
OwnValues returns rules corresponding to definitions made for symbols:
x = 5;OwnValues[x]x1 = 1;x2 = 3;y = 5;Obtain the ownvalues of symbols whose names start with x:
OwnValues /@ Names["x*"]OwnValues can be used to set values directly:
OwnValues[y] = {y :> 17};Definition[y]yApplications (2)
The resulting rules are in the order given:
x /; y > -2 := f
x /; y < 2 := gOwnValues[x]Block[{y = 0}, x]OwnValues[x] = Reverse[OwnValues[x]]Block[{y = 0}, x]Copy a symbol's definitions to another symbol:
x = 7;OwnValues[y] = OwnValues[x] /. HoldPattern[x] -> yy% == xProperties & Relations (6)
Values can be defined by immediate or delayed assignments:
x = 17;
r := RandomReal[];{OwnValues[x], OwnValues[r]}HoldPattern is used to protect the rules from their own definitions:
x = 5;OwnValues[x]x :> 5OwnValues has attribute HoldAll to protect against its argument's values:
x = y;{OwnValues[x], OwnValues[Evaluate[x]]}OwnValues["sym"] will issue a message if the specified symbol does not exist:
OwnValues["x"]If the symbol exists but has no definitions, an empty list is returned:
x;
OwnValues["x"]Definition and Information display ownvalues but do not return them as values:
x = 5;Definition[x]OwnValues returns a value that can be used in a program:
OwnValues[x]Evaluation of a symbol is equivalent to applying the rules for its definition:
x = 5;Hold[x] /. OwnValues[x]See Also
Set SetDelayed DownValues UpValues SubValues Information ValueQ Clear ClearAll Save
Function Repository: DefinedSymbols
Tech Notes
Related Guides
Related Workflows
- Clear Definitions for Symbols and Functions
History
Introduced in 1991 (2.0) | Updated in 1996 (3.0) ▪ 2022 (13.2)
Text
Wolfram Research (1991), OwnValues, Wolfram Language function, https://reference.wolfram.com/language/ref/OwnValues.html (updated 2022).
CMS
Wolfram Language. 1991. "OwnValues." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/OwnValues.html.
APA
Wolfram Language. (1991). OwnValues. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/OwnValues.html
BibTeX
@misc{reference.wolfram_2026_ownvalues, author="Wolfram Research", title="{OwnValues}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/OwnValues.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_ownvalues, organization={Wolfram Research}, title={OwnValues}, year={2022}, url={https://reference.wolfram.com/language/ref/OwnValues.html}, note=[Accessed: 13-June-2026]}