Vocabulary/eqdot

From J Wiki
Jump to navigation Jump to search

>> <<   Back to: Vocabulary Thru to: Dictionary

=. Is (Local) Other

Attaches a value to a name to yield a definition.

This is called private assignment.

   myname =. 99     NB. defines: myname to be a noun: 99

   myname
99
   myname + 1
100

Unlike Is (Global) (=:), the definition goes away when the "process" executing the assignment terminates. If the name has already been defined before the "process" starts, then the previous value is reinstated.

This is called private assignment.

"Process" here means either executing an explicitly defined verb, or loading a J script.

Apart from that, everything said concerning Is (Global) (=:) applies to (=.) also.

In particular, if an assignment using (=.) is executed within the J session window, then (=.) behaves exactly like (=:).


Common uses

1. Create nouns, adverbs, conjunctions and verbs that persist only while the verb (/script) that assigns them is running (/loading), masking any prior definition of the same name.

2. Use =. where other languages employ a local(ized) variable.


More Information

See Private and Public Assignment

Important.png Find time to study Private and Public Assignment carefully,


since it describes and explains all uses of =. and =:


CategoryVoc CategoryVocAssign CategoryVocValue CategoryVocVariable