From 6f3612539c425da2bc1d34db621696e6a273b01c Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 18 Nov 2010 23:00:31 +0200 Subject: Bring latest byte code gawk into git. Hurray! --- test/aarray1.awk | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/aarray1.awk (limited to 'test/aarray1.awk') diff --git a/test/aarray1.awk b/test/aarray1.awk new file mode 100644 index 00000000..a3c4f936 --- /dev/null +++ b/test/aarray1.awk @@ -0,0 +1,28 @@ +BEGIN { + a[1][1] = 10; + a[1][2] = 20; + a[1][3] = 30; + a[2] = "hello world! we have multi-dimensional array" + a[3, "X"] = "Y" + print length(a), length(a[1]) + delete a[2] + delete a[3, "X"] + a[2][1] = 100; + a[2][2] = 200; + a[2][3] = 300; + for (i in a) { + sum[i] = 0 + for (j in a[i]) + sum[i] += a[i][j] + } + print sum[1], sum[2] + f(a[1]) + print a[1][1] +} + +function f(x, i) +{ + for (i=1;i<=length(x);i++) + print x[i] + x[1] = 1001 +} -- cgit v1.2.3