Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 27 |
Nodes: | 6 (0 / 6) |
Uptime: | 38:01:15 |
Calls: | 631 |
Calls today: | 2 |
Files: | 1,187 |
D/L today: |
22 files (29,767K bytes) |
Messages: | 173,681 |
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: