Groups | Search | Server Info | Login | Register
Groups > comp.lang.awk > #10013
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Kaz Kylheku <643-408-1753@kylheku.com> |
| Newsgroups | comp.lang.awk |
| Subject | Re: GAWK mystery parses |
| Date | Fri, 3 Oct 2025 06:20:34 -0000 (UTC) |
| Organization | A noiseless patient Spider |
| Lines | 26 |
| Message-ID | <20251002231443.863@kylheku.com> (permalink) |
| References | <10bnjs1$br9v$1@news.xmission.com> |
| Injection-Date | Fri, 03 Oct 2025 06:20:36 +0000 (UTC) |
| Injection-Info | dont-email.me; posting-host="9b3aa9c82644305f4183a473fbe1cecd"; logging-data="1578185"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KjdVJsSn0Zdrj4vujL5zmO9c1NAvf7fs=" |
| User-Agent | slrn/pre1.0.4-9 (Linux) |
| Cancel-Lock | sha1:Wm3SQoKQwpgQ0igFQ1Nu5RcgvRc= |
| Xref | csiph.com comp.lang.awk:10013 |
Show key headers only | View raw
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:
$ mawk 'BEGIN { for (i=1; i<=5; print "i =",i++); }'
mawk: line 1: syntax error at or near print
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
Back to comp.lang.awk | Previous | Next — Previous in thread | Next in thread | Find similar
GAWK mystery parses gazelle@shell.xmission.com (Kenny McCormack) - 2025-10-03 04:36 +0000
Re: GAWK mystery parses Kaz Kylheku <643-408-1753@kylheku.com> - 2025-10-03 06:20 +0000
Re: GAWK mystery parses gazelle@shell.xmission.com (Kenny McCormack) - 2025-10-03 07:06 +0000
csiph-web