func f(a) { # argument is local to the function var b = 100; # local to the function c = 100; # local to the function; does not overwrite outer c return a + 1; } var a = 10; # local at top level var b = 20; # local at top level c = 30; # local at top level; there is no more-outer-scope c if (NR == 3) { var a = 40; # scoped to the if-statement; doesn't overwrite outer a b = 50; # not scoped to the if-statement; overwrites outer b c = 60; # not scoped to the if-statement; overwrites outer c d = 70; # there is no outer d so a local d is created here $inner_a = a; $inner_b = b; $inner_c = c; $inner_d = d; } $outer_a = a; $outer_b = b; $outer_c = c; $outer_d = d; # there is no outer d defined so no assignment happens