DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(gawk) Data Type Summary

Info Catalog (gawk) Arrays Summary (gawk) Variables/Fields
 
 Data Types
 ----------
 
    The value of an `awk' expression is always either a number or a
 string.
 
    Some contexts (such as arithmetic operators) require numeric values.
 They convert strings to numbers by interpreting the text of the string
 as a number.  If the string does not look like a number, it converts to
 zero.
 
    Other contexts (such as concatenation) require string values.  They
 convert numbers to strings by effectively printing them with `sprintf'.
  Conversion of Strings and Numbers Conversion, for the details.
 
    To force conversion of a string value to a number, simply add zero
 to it.  If the value you start with is already a number, this does not
 change it.
 
    To force conversion of a numeric value to a string, concatenate it
 with the null string.
 
    Comparisons are done numerically if both operands are numeric, or if
 one is numeric and the other is a numeric string.  Otherwise one or
 both operands are converted to strings and a string comparison is
 performed.  Fields, `getline' input, `FILENAME', `ARGV' elements,
 `ENVIRON' elements and the elements of an array created by `split' are
 the only items that can be numeric strings. String constants, such as
 `"3.1415927"' are not numeric strings, they are string constants.  The
 full rules for comparisons are described in  Variable Typing and
 Comparison Expressions Typing and Comparison.
 
    Uninitialized variables have the string value `""' (the null, or
 empty, string).  In contexts where a number is required, this is
 equivalent to zero.
 
     Variables, for more information on variable naming and
 initialization;  Conversion of Strings and Numbers Conversion.,
 for more information on how variable values are interpreted.
 
Info Catalog (gawk) Arrays Summary (gawk) Variables/Fields
automatically generated byinfo2html