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,073 |
Nodes: | 10 (0 / 10) |
Uptime: | 222:34:35 |
Calls: | 13,783 |
Calls today: | 1 |
Files: | 186,987 |
D/L today: |
701 files (242M bytes) |
Messages: | 2,434,871 |