Sujet : Re: Loops (was Re: do { quit; } else { })
De : flexibeast (at) *nospam* gmail.com (Alexis)
Groupes : comp.lang.cDate : 19. Apr 2025, 02:01:57
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87ecxp7ym2.fsf@gmail.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13)
bart <
bc@freeuk.com> writes:
* Awk primarily uses a C-style for loop; using 'for in' is an
alternative (it's not clear if this is specific to gnu-Awk)
It's POSIX. Quoting awk(1p):
| Syntax | Name | Type of Result | Associativity |
| [...] | | | |
| expr in array | Array membership | Numeric | Left |
| ( index ) in array | Multi-dimension | Numeric | Left |
| | array membership | | |
[...]
The delete statement shall remove an individual array element. Thus,
the following code deletes an entire array:
for (index in array)
delete array[index]
Alexis.