File: gawk.info, Node: Expressions Summary, Prev: Locales, Up: Expressions 6.7 Summary =========== * Expressions are the basic elements of computation in programs. They are built from constants, variables, function calls, and combinations of the various kinds of values with operators. * 'awk' supplies three kinds of constants: numeric, string, and regexp. 'gawk' lets you specify numeric constants in octal and hexadecimal (bases 8 and 16) as well as decimal (base 10). In certain contexts, a standalone regexp constant such as '/foo/' has the same meaning as '$0 ~ /foo/'. * Variables hold values between uses in computations. A number of built-in variables provide information to your 'awk' program, and a number of others let you control how 'awk' behaves. * Numbers are automatically converted to strings, and strings to numbers, as needed by 'awk'. Numeric values are converted as if they were formatted with 'sprintf()' using the format in 'CONVFMT'. Locales can influence the conversions. * 'awk' provides the usual arithmetic operators (addition, subtraction, multiplication, division, modulus), and unary plus and minus. It also provides comparison operators, Boolean operators, an array membership testing operator, and regexp matching operators. String concatenation is accomplished by placing two expressions next to each other; there is no explicit operator. The three-operand '?:' operator provides an "if-else" test within expressions. * Assignment operators provide convenient shorthands for common arithmetic operations. * In 'awk', a value is considered to be true if it is nonzero _or_ non-null. Otherwise, the value is false. * A variable's type is set upon each assignment and may change over its lifetime. The type determines how it behaves in comparisons (string or numeric). * Function calls return a value that may be used as part of a larger expression. Expressions used to pass parameter values are fully evaluated before the function is called. 'awk' provides built-in and user-defined functions; this is described in *note Functions::. * Operator precedence specifies the order in which operations are performed, unless explicitly overridden by parentheses. 'awk''s operator precedence is compatible with that of C. * Locales can affect the format of data as output by an 'awk' program, and occasionally the format for data read as input.