3 ms·
Why do you find it odd? I find it to be the very best introduction to C-style control structures. Chapter 2 of The AWK Programming Language has incredible bene
by chasil 7y ago
Why do you find it odd? I find it to be the very best introduction to C-style control structures.
Chapter 2 of The AWK Programming Language has incredible benefits for a novice.
https://archive.org/download/pdfy-MgN0H1joIoDVoIC7/The_AWK_Programming_Language.pdf https://archive.org/download/pdfy-MgN0H1joIoDVoIC7/The_AWK_P...
- jolmg 7y agoThey probably refer to how it has the top-level as <line-condition> { <code> } That's unusual enough among programming languages to call it odd. Being able to do stuff like if (/some-pattern/) { ... and have the regex be evaluated like a condition where it matches with the current line implicitly is also pretty unique.
- funkymike 7y agoif (/some-pattern/) { ... This isn't really unique when you consider perl. while (<>) { if (/pattern/) { This does the same. Awk simply has the implicit loop.
- jolmg 7y agoYes, I think Perl based that on Awk, but then those are the only 2 languages I know that support something like that. That's still very unique. On the implicit loop, along with Ruby, they're the only 3 languages I know that support something like that. That's also pretty unique, and Awk is the only one that has the implicit loop as a requirement.
- naniwaduni 7y agoThe implicit loop is uncommon among general-purpose langauges, but very common among filtering-centric languages like awk and grep and sed. For a more recent example, see jq. perl 5 may be close to the only mainstream general-purpose language to have embraced that paradigm though.