bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] nested loop of arbitary number of elements in a hash of h


From: Peng Yu
Subject: Re: [bug-gawk] nested loop of arbitary number of elements in a hash of hash
Date: Tue, 9 Apr 2019 09:38:17 -0500

No. It’s not to traverse a multidimensional array but traverse the
cross product of multiple 1-d arrays.

On 4/9/19, address@hidden <address@hidden> wrote:
> I'm not sure what you're asking. But I think what you want is
> not a nested loop, but rather a traversal of the full multidimensional
> array. There is a an example of doing this in the manual, using
> isarray() and recursion.  See there.
>
> Arnold
>
> Peng Yu <address@hidden> wrote:
>
>> Hi,
>>
>> "input" is a hash of hash. The following example is a nested loop
>> assuming there are only "1" "2" and "3" in the first level of the
>> hash. If there are an arbitrary number of elements in the first level,
>> what is the best way to construct a nested loop? Thanks.
>>
>>   for(j1 in input[1]) {
>>     for(j2 in input[2]) {
>>       for(j3 in input[3]) {
>> # do something
>>       }
>>     }
>>   }
>>
>> --
>> Regards,
>> Peng
>


-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]