|
Other than the looping operators, such as <LOOP>
,
<SQL>
, or <fetch>
,
there is no way to access the individual members of a
variable. This is consistent with Vortex' overall philosophy of making
common tasks easier; other languages bog down with multi-statement
for
loops, counter variables, and end-of-loop checks to
manage arrays.
The <LOOP>
statement, which we used in the previous
example, is worth a closer look:
<SCRIPT LANGUAGE=vortex>
<A NAME=main>
<$things= apple hair lemon leaf ocean grape soil night>
<$colors= red orange yellow green blue purple brown black>
<LOOP SKIP=2 MAX=4 $colors $things>
Color #$loop is $things $colors <BR>
</LOOP>
The next color is #$next
</A>
</SCRIPT>
|
In this example we have two parallel lists, $things
and
$colors
. We iterate over just 4 members of the list
(MAX=4
) - after skipping the first 2 (SKIP=2
).
If we run this script, we see the results:
|