Hacker News new | ask | show | jobs
by rbonvall 864 days ago
Awk doesn't have a way to define function-local variables. All variables are global, except for function parameters.

This spacing convention is meant to clearly separate mandatory parameters and optional parameters that are sometimes only introduced to "declare" a local variable.

3 comments

Here's where the manual introduces the convention: https://www.gnu.org/software/gawk/manual/gawk.html#Variable-...
Thanks; this may be one of the most weird conventions I've ever come across. Maybe that's a 'me' thing.
Oh cool, thank you!!