awk
Many programming languages have a special representation for the concepts
of "true" and "false."  Such languages usually use the special
constants true and false, or perhaps their upper-case
equivalents.
awk is different.  It borrows a very simple concept of true and
false from C.  In awk, any non-zero numeric value, or any
non-empty string value is true.  Any other value (zero or the null
string, "") is false.  The following program will print `A strange
truth value' three times:
BEGIN {
   if (3.1415927)
       print "A strange truth value"
   if ("Four Score And Seven Years Ago")
       print "A strange truth value"
   if (j = 57)
       print "A strange truth value"
}
There is a surprising consequence of the "non-zero or non-null" rule:
The string constant "0" is actually true, since it is non-null (d.c.).
Go to the first, previous, next, last section, table of contents.