({{, (RefLink[Key, paclet:ref/Key])[key] 
represents a key used to access a value in an association.}, {, (RefLink[Key, paclet:ref/Key])[key][assoc]
extracts the value corresponding to key in the association assoc.}})

OpenersNotesSection(Spacer1)Details

(RefLink[Key, paclet:ref/Key]) is used in functions such as (RefLink[Part, paclet:ref/Part]) to access values in (RefLink[Association, paclet:ref/Association]) objects.

(RefLink[Key, paclet:ref/Key]) can normally be omitted when key is a string.

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Extract a value from an association as a part:

<|a->b,c->d|>[[Key[a]]]

Extract a value from an association by function application:

<|a->b,c->d|>[a]

The (RefLink[Key, paclet:ref/Key]) wrapper is not necessary when the key is a string:

<|"a"->b,"c"->d|>[["a"]]

Lookups in associations interoperate with parts in lists and other expressions:

{<|a->x,b->{y,z}|>,w}[[1,Key[b],2]]

The explicit (RefLink[Key, paclet:ref/Key]) can be omitted when the keys in an association are strings:

{<|"a"->x,"b"->z|>}[[1,"b"]]

<|"a"->b,"c"->d|>["a"]

(RefLink[Key, paclet:ref/Key]) is normally generated by functions such as (RefLink[Position, paclet:ref/Position]):

Position[<|a->1,b->2|>,_Integer]

Use (RefLink[Extract, paclet:ref/Extract]) to extract the values:

Extract[<|a->1,b->2|>,%]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Part, paclet:ref/Part])  ▪  (RefLink[Association, paclet:ref/Association])  ▪  (RefLink[Keys, paclet:ref/Keys])  ▪  (RefLink[KeyExistsQ, paclet:ref/KeyExistsQ])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Associations, paclet:guide/Associations])}, {▪(RefLinkPlain[Function Composition & Operator Forms, paclet:guide/FunctionCompositionAndOperatorForms])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/34-associations.html])(WebLink[: Associations, https://www.wolfram.com/language/elementary-introduction/34-associations.html])}})}})