Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


gives the value of name in options matched by OptionsPattern.

gives the value of name for options associated with the head f.

extracts option values from the explicit list of rules opts.

extracts several option values.


  • OptionValue[name] is equivalent to OptionValue[f,name], where f is the head of the left-hand side of the transformation rule in which OptionValue[name] appears.
  • OptionValue[f,name] and OptionValue[name] will use values from the first OptionsPattern object that appears as an argument of f.
  • In OptionValue[f,opts,name], only the explicit list opts and the defaults derived from f will be considered.
  • In OptionValue[f,opts,name], f can be a symbol, a rule, or a list of symbols and rules specifying default values. Each symbol s in f is equivalent to Options[s]. If the same option name is specified multiple times, the first specification determines the default.
  • OptionValue[f,opts,name,Hold] returns the option value with Hold wrapped around it.
  • OptionValue[Automatic,Automatic,name,Hold] is equivalent to OptionValue[name], except that the option value is returned with Hold wrapped around it.
  • OptionValue ignores contexts when comparing option names and treats the symbol s and the string SymbolName[s] interchangeably.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Define default option values for the function f:

Click for copyable input

Define f, allowing options to be given:

Click for copyable input

Use f with an explicit option setting:

Click for copyable input

Use f with options taken to have their default values:

Click for copyable input
Introduced in 2007