Previous: Indirect Calls, Up: Functions [Contents][Index]
awk
provides built-in functions and lets you define your own
functions.
awk
provides three kinds of built-in functions: numeric,
string, and I/O. gawk
provides functions that sort arrays, work
with values representing time, do bit manipulation, determine variable
type (array versus scalar), and internationalize and localize programs.
gawk
also provides several extensions to some of standard
functions, typically in the form of additional arguments.
sub()
and gsub()
is not simple.
It is more straightforward in gawk
’s gensub()
function,
but that function still requires care in its use.
ARGC
)
as the name of a parameter in user-defined functions.
return
statement to return from a user-defined function.
An optional expression becomes the function’s return value. Only scalar
values may be returned by a function.
gawk
provides indirect function calls using a special syntax.
By setting a variable to the name of a function, you can
determine at runtime what function will be called at that point in the
program. This is equivalent to function pointers in C and C++.
Previous: Indirect Calls, Up: Functions [Contents][Index]