Loops/With multiple ranges: Difference between revisions

(→‎{{header|TXR}}: Make macro work harder, so programmer just specifies loop initial and final values and step.)
Line 1,212:
<pre>sum = 348173
prod = -793618560</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight lang="text">prod = 1
sum = 0
x = 5
y = -5
z = -2
one = 1
three = 3
seven = 7
ranges[][] = [ [ -three (pow 3 3) three ] [ -seven seven x ] [ 555 (550 - y) ] [ 22 -28 (-three) ] [ 1927 1939 ] [ x y z ] [ (pow 11 x) (pow 11 x + one) ] ]
#
for i range len ranges[][]
j = ranges[i][0]
to = ranges[i][1]
inc = 1
if len ranges[i][] = 3
inc = ranges[i][2]
.
repeat
until inc > 0 and j > to or inc < 0 and j < to
sum += abs j
if abs prod < pow 2 27 and j <> 0
prod *= j
.
j += inc
.
.
print sum
print prod</syntaxhighlight>
 
=={{header|Eiffel}}==
1,983

edits