assign

Last edit

Summary: wiki syntax fixes

Added:

> {{{

Added:

> }}}

Added:

> {{{

Added:

> }}}


The assignment operator

In awk, as with most other programming languages, the *equals sign* acts as a [[dyadic?]] *assignment operator* assigning the value of the [[expression?]] of the right hand [[operand?]] to the variable named by the left [[operand?]]:

Assignment of variables

The following examples show the use of the equals sign for the assignment of variables:

 fruit = "apple"   # assign a string to a variable
 count = 5         # assign a numeric value to a variable

Multiple assignments

The awk language supports multiple assignments as follows:

 x = y = z = 3