GNU Info

Info Node: (gawk.info)Dynamic Typing

(gawk.info)Dynamic Typing


Prev: Return Statement Up: User-defined
Enter node , (file) or (file)node

Functions and Their Effect on Variable Typing
---------------------------------------------

   `awk' is a very fluid language.  It is possible that `awk' can't
tell if an identifier represents a regular variable or an array until
runtime.  Here is an annotated sample program:

     function foo(a)
     {
         a[1] = 1   # parameter is an array
     }
     
     BEGIN {
         b = 1
         foo(b)  # invalid: fatal type mismatch
     
         foo(x)  # x uninitialized, becomes an array dynamically
         x = 1   # now not allowed, runtime error
     }

   Usually, such things aren't a big issue, but it's worth being aware
of them.


automatically generated by info2www version 1.2.2.9