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 <gazelle@shell.xmission.com> 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,090 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 63:14:04 |
| Calls: | 13,949 |
| Calls today: | 2 |
| Files: | 187,035 |
| D/L today: |
3,464 files (1,014M bytes) |
| Messages: | 2,461,403 |