|
From: | Jaromir Obr |
Subject: | Re: [bug-gawk] Missing double quotes in SYMTAB example in docs |
Date: | Mon, 11 Jul 2016 20:23:16 +0200 |
BEGIN { i = 10 multiply(i, 2) print i } function multiply(i, amount) { return SYMTAB[i] *= amount }but it didn't work as expected (result is 10 instead 20). Therefore I would expect SYMTAB["i"].
if it used less descriptive names, say a and b, would you still say it needs double quotes?# Indirect multiply of any variable by amount, return resultfunction multiply(a, b) { return SYMTAB[a] *= b }On Sun, Jul 10, 2016 at 10:24 AM, Jaromir Obr <address@hidden> wrote:Hi,in https://www.gnu.org/software/gawk/manual/gawk.html#index-differences-in-awk-and-gawk_002c-SYMTAB-variable there is an example:# Indirect multiply of any variable by amount, return resultfunction multiply(variable, amount) { return SYMTAB[variable] *= amount }There are missing double quotes around variable, aren't they ? (expected is return SYMTAB["variable"] *= amountRegardsJaromir
[Prev in Thread] | Current Thread | [Next in Thread] |