aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawk.texi
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-07-28 10:43:40 +0300
committerArnold D. Robbins <arnold@skeeve.com>2017-07-28 10:43:40 +0300
commit7bcdeaa73e2fc4f0e2272b871e958b63d428b270 (patch)
tree9c3f1332aaa9e855cfb4d450ad87cb15883cd725 /doc/gawk.texi
parent12385433e64d8c2c497765d9834bf0e20e1a602d (diff)
downloadegawk-7bcdeaa73e2fc4f0e2272b871e958b63d428b270.tar.gz
egawk-7bcdeaa73e2fc4f0e2272b871e958b63d428b270.tar.bz2
egawk-7bcdeaa73e2fc4f0e2272b871e958b63d428b270.zip
Doc - improve example for untyped variables.
Diffstat (limited to 'doc/gawk.texi')
-rw-r--r--doc/gawk.texi19
1 files changed, 13 insertions, 6 deletions
diff --git a/doc/gawk.texi b/doc/gawk.texi
index b75c2d00..66312691 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -20042,17 +20042,24 @@ BEGIN @{
@item "untyped"
@var{x} has not yet been used yet at all; it can become a scalar or an
-array.
-For example:
+array. The typing could even conceivably differ from run to run of
+the same program! For example:
@example
BEGIN @{
- print typeof(x) # x never used --> untyped
- mk_arr(x)
- print typeof(x) # x now an array --> array
+ print "initially, typeof(v) = ", typeof(v)
+
+ if ("FOO" in ENVIRON)
+ make_scalar(v)
+ else
+ make_array(v)
+
+ print "typeof(v) =", typeof(v)
@}
-function mk_arr(a) @{ a[1] = 1 @}
+function make_scalar(p, l) @{ l = p @}
+
+function make_array(p) @{ p[1] = 1 @}
@end example
@end table