The topic for today is: What can we get away with for clause 3 of a "for" statement.
Observe (notice that the print statement is *inside* the for statement):
First, we use a print statement as clause 3:
% gawk4 'BEGIN { for (i=1; i<=5; print "i =",i++); }'
i = 1
i = 2
i = 3
i = 4
i = 5
On 2025-10-03, Kenny McCormack <[email protected]> wrote:
The topic for today is: What can we get away with for clause 3 of a "for"
statement.
Observe (notice that the print statement is *inside* the for statement):
First, we use a print statement as clause 3:
% gawk4 'BEGIN { for (i=1; i<=5; print "i =",i++); }'
i = 1
i = 2
i = 3
i = 4
i = 5
That's interesting, and useless; yet, stupidly, you cannot have comma >expressions like for (i = 0, j = 0; ...
What you found is not portable:
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,136 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 09:34:40 |
| Calls: | 14,591 |
| Calls today: | 2 |
| Files: | 186,473 |
| D/L today: |
5,479 files (1,630M bytes) |
| Messages: | 2,577,430 |