Values

Values[key1val1,key2val2,]

gives a list of the values vali in an association.

Values[{key1val1,key2val2,}]

gives a list of the vali in a list of rules.

Values[expr,h]

gives a list of values in expr, wrapping each of them with head h before evaluation.

Details

  • Values maintains the order of values.
  • Values[key->val] gives val.
  • Use Values[expr,Hold] to extract values without letting them evaluate.

Examples

open all close all

Basic Examples  (4)

Get the values in an association:

In[1]:=
Click for copyable input
Out[1]=

Get values from a list of rules:

In[1]:=
Click for copyable input
Out[1]=

Values automatically threads over lists:

In[1]:=
Click for copyable input
Out[1]=

Wrap values with Hold to prevent evaluation:

In[1]:=
Click for copyable input
Out[1]=

Properties & Relations  (3)

Introduced in 2014
(10.0)
|
Updated in 2019
(12.0)