This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

OptionValue

OptionValue[name]
gives the value of name in options matched by OptionsPattern.
OptionValue[f, name]
gives the value of name for options associated with the head f.
OptionValue[f, opts, name]
extracts option values from the explicit list of rules opts.
  • OptionValue[{opt1->val1, ...}, ...] gives explicit forms for default option values.
  • OptionValue[{spec1, spec2, ...}, ...] allows either fi or opti->vali as specifications of default option values. Each head is treated as the list of rules obtained from Options[fi].
Define default option values for the function f:
Define f, allowing options to be given:
Use f with an explicit option setting:
Use f with options taken to have their default values:
Define default option values for the function f:
In[1]:=
Click for copyable input
Define f, allowing options to be given:
In[2]:=
Click for copyable input
Use f with an explicit option setting:
In[3]:=
Click for copyable input
Out[3]=
Use f with options taken to have their default values:
In[4]:=
Click for copyable input
Out[4]=
New in 6