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,089 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 153:54:18 |
| Calls: | 13,921 |
| Calls today: | 2 |
| Files: | 187,021 |
| D/L today: |
3,760 files (944M bytes) |
| Messages: | 2,457,163 |