Re: The name of script itself



In article <QIGdnYTEG5hroCDeRVn-tw@xxxxxxxxxxx>,
Ed Morton <morton@xxxxxxxxxxxxxx> wrote:
....
>The order of the indices you get from "in" isn't guaranteed to be the
>numerically sorted so the above might produce "file" "gawk" "-f" or some
>other order. You need this instead if you want to do it in a loop:

That was my first thought, and, yes, in general, it is more idiomatic to
use a normal "C-style" for loop instead of the "foreach" style version.
But then I looked at it more carefully...

I think in this case, it would actually be OK to do it that way, provided
you were willing to assume that there's only one "-f". I.e., note that
even though he's accessing the array in random order, he is pulling the
"each+1" element once he finds a match.

.



Relevant Pages

  • Re: elegant solution for counting runs
    ... has to test (within a loop through the sequence) for the first ... Shift the array by 1 and check if the entries in the new array and ... entries that did match. ... prev) then ...
    (comp.lang.fortran)
  • Re: For Loop Help
    ... just use an array: ... > To a for loop that changes the variable name so I don't have to list them, ... 'Faith without judgement merely degrades the spirit divine.' ... Prev by Date: ...
    (comp.lang.javascript)
  • Muti Dimmed Array Problem
    ... I am trying to create an array that will eventually loop to update ... corresponding record in a database. ... Prev by Date: ...
    (microsoft.public.scripting.vbscript)
  • Re: Buffer overflow Article - CACM
    ... > As for Robert's note about explicit indices, it would be nice to have ... > for E in X loop ... ... No indexing off the end of the array. ... Prev by Date: ...
    (comp.lang.ada)
  • Re: The name of script itself
    ... >> even though he's accessing the array in random order, ... Probably, the last one is the one you want, so you should run the loop ... Prev by Date: ...
    (comp.lang.awk)