({{, lhs^=rhs
assigns rhs to be the value of lhs, and associates the assignment with symbols that occur at level one in lhs. }})

OpenersNotesSection(Spacer1)Details

f[g[x]]=value makes an assignment associated with f. f[g[x]]^=value makes an assignment associated instead with g.

(RefLink[UpSet, paclet:ref/UpSet]) associates an assignment with all the distinct symbols that occur either directly as arguments of lhs, or as the heads of arguments of lhs.

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Define a symbolic property of a symbol:

area[square]^=s^2

OpenersExampleSection1(Spacer1)Scope  (2)

^= defines upvalues:

area[square]^=s^2

UpValues[square]

If several symbols appear in the left-hand side, upvalues for all of them are defined:

prop[a,b[c]]^=value;

Definition[a]

Definition[b]

OpenersExampleSection2(Spacer1)Applications  (1)

Build a database of exchange rates:

rate[chf]^=0.812;
rate[eur]^=1.317;
rate[gbp]^=1.963;

rate[chf]/rate[eur]

OpenersExampleSection3(Spacer1)Properties & Relations  (2)

^= defines upvalues in the same way as using a tag does:

square/:area[square]=a^2;
area[rectangle]^=a*b;

{UpValues[square],UpValues[rectangle]}

^= defines upvalues; = defines downvalues:

area[square]^=s^2;
area[rectangle]=a*b;

UpValues[square]

UpValues[rectangle]

DownValues[area]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[TagSet, paclet:ref/TagSet])  ▪  (RefLink[UpSetDelayed, paclet:ref/UpSetDelayed])  ▪  (RefLink[UpValues, paclet:ref/UpValues])  ▪  (RefLink[Unset, paclet:ref/Unset])  ▪  (RefLink[ClearAll, paclet:ref/ClearAll])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Associating Definitions with Different Symbols, paclet:tutorial/AssociatingDefinitionsWithDifferentSymbols])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Package Development, paclet:guide/PackageDevelopment])}, {▪(RefLinkPlain[Language Overview, paclet:guide/LanguageOverview])}, {▪(RefLinkPlain[Assignments, paclet:guide/Assignments])}})}})