Re: [Seed7-users] The `range' function
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
|
From: Duke N. <duk...@gm...> - 2022-06-14 13:29:24
|
On Tue, 14 Jun 2022 07:55:48 +0200
Thomas Mertes <tho...@gm...> wrote:
> On Mon, 13 Jun 2022 21:08:00 +0200
> Duke Normandin <dukeof...@gm...> wrote:
> > In your manual, you have the following examples:
> >
> > for number range [] (0, 1, 2, 3, 5, 8, 13, 20, 40, 100) do
> > for innerPlanet range {"Mercury", "Venus", "Earth", "Mars"} do
> > for letter range "the quick brown fox jumps over the lazy dog"
> > do
> >
> > Is it correct to think of `range' to mean: "to the length of"?
> > for number "to the length of" [] (0, 1, 2, .... 20, 40,100) do
>
> I don't know what you mean with "to the length of".
> There is no 'range' function. Instead the keyword 'range' is
> part of the for-loop. In case of
It's not clear what the meaning of `range' is. Usually in other
languages it can mean something like [i .. i_nth] a generator.
So I was translating the seed7 for loop as:
for [number=1 to the length of the array] do
<some_code>
end for;
I assume that number is incremented internally. Something like the
`foreach' construct in some languages.
--
Duke
** Bottom-posting, text-only is the netiquette way! **
|