summaryrefslogtreecommitdiff
path: root/test/aryunasgn.awk
blob: ccb3fd235c62f5f6995fd1d22b10d8cb6bb3cca8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
BEGIN {
    a[i] = "null"                         # i is initially undefined
    for (i in a) {                        # i is null string
        print length(i), a[i] # , typeof(i)  # 0 null
        print (i==0), (i=="")             # 1 1  should be  0 1
    }
    print a[""]                           # null
    print a[0]                            #

    b[$2] = "null also"                   # $2 is also undefined
    for (j in b) {
        print length(j), a[j] # , typeof(i)  # 0 null
        print (j==0), (j=="")             # 1 1  should be  0 1
    }
    print b[""]                           # null
    print b[0]                            #
}