In article
<5de8b96e-75af-4e74-9c9f-46d9c5dc69d8@[EMAIL PROTECTED]
>,
iaminsik <iaminsik@[EMAIL PROTECTED]
> wrote:
....
>I've never heard of declare variables as 'local' in awk.
TAWK has true local variables, which is very nice, but in "standard"
AWK it is done via a (widely accepted and practiced) kludge. See below.
>>
>> I would declare then (in the "function" statement) so there would be,
>> for example, no chance of "i" in one routine conflicting with "i" in
>> another.- µû¿Â ÅØ½ºÆ® ¼û±â±â -
>
>Can you show an example?
The idea is that you declare your funciton like this:
function foo(arg1,arg2, tmp1,tmp2,tmp3) {}
And then call it with only 2 args. The additional args get initalized
to "" (as if they had been passed by the caller as ""), and act like
local variables in the function.
It is also conventional to separate the "real" args from the fake args,
with whitespace, as I have done above.


|