AWK - Exponential Operators


Advertisements

There are two formats of exponential operators −

Exponential Format 1

It is an exponential operator that raises the value of an operand. For instance, the following example raises the value of 10 by 2.

Example

[jerry]$ awk 'BEGIN { a = 10; a = a ^ 2; print "a =", a }'

On executing this code, you get the following result −

Output

a = 100

Exponential Format 2

It is an exponential operator that raises the value of an operand. For instance, the following example raises the value of 10 by 2.

Example

[jerry]$ awk 'BEGIN { a = 10; a = a**2; print "a =", a }'

On executing this code, you get the following result

Output

a = 10
awk_operators.htm
Advertisements