diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-06-26 12:46:54 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-06-26 12:46:54 +0300 |
commit | 8a4905be350313d41f6c0b20497809760d7fa84e (patch) | |
tree | 0169eb762b2175202db1c9cd889a2b2bc8bbb4bc /doc/gawk.texi | |
parent | 0a2de15cba710ff67107bc340950515e1a29edb5 (diff) | |
download | egawk-8a4905be350313d41f6c0b20497809760d7fa84e.tar.gz egawk-8a4905be350313d41f6c0b20497809760d7fa84e.tar.bz2 egawk-8a4905be350313d41f6c0b20497809760d7fa84e.zip |
Improve values returned by typeof. Fix tests and doc.
Diffstat (limited to 'doc/gawk.texi')
-rw-r--r-- | doc/gawk.texi | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/doc/gawk.texi b/doc/gawk.texi index 7552f164..64f494a0 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -19503,14 +19503,43 @@ Return one of the following strings, depending upon the type of @var{x}: @item "regexp" @var{x} is a strongly typed regexp (@pxref{Strong Regexp Constants}). -@item "scalar_n" +@item "number" @var{x} is a number. -@item "scalar_s" +@item "string" @var{x} is a string. +@item "strnum" +@var{x} is a string that might be a number, such as a field or +the result of calling @code{split()}. (I.e., @var{x} has the STRNUM +attribute; @pxref{Variable Typing}.) + +@item "unassigned" +@var{x} is a scalar variable that has not been assigned a value yet. +For example: + +@example +BEGIN @{ + a[1] # creates a[1] but it has no assigned value + print typeof(a[1]) # scalar_u +@} +@end example + @item "untyped" -@var{x} has not yet been given a type. +@var{x} has not yet been used yet at all; it can become a scalar or an +array. +For example: + +@example +BEGIN @{ + print typeof(x) # x never used --> untyped + mk_arr(x) + print typeof(x) # x now an array --> array +@} + +function mk_arr(a) @{ a[1] = 1 @} +@end example + @end table @end table |