xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/aryunasgn.awk (revision 8a2b682e57a046b828f37bcde1776f131ef4629f)
1BEGIN {
2    a[i] = "null"                         # i is initially undefined
3    for (i in a) {                        # i is null string
4        print length(i), a[i] # , typeof(i)  # 0 null
5        print (i==0), (i=="")             # 1 1  should be  0 1
6    }
7    print a[""]                           # null
8    print a[0]                            #
9
10    b[$2] = "null also"                   # $2 is also undefined
11    for (j in b) {
12        print length(j), a[j] # , typeof(i)  # 0 null
13        print (j==0), (j=="")             # 1 1  should be  0 1
14    }
15    print b[""]                           # null
16    print b[0]                            #
17}
18