Loops/With multiple ranges: Difference between revisions

Content added Content deleted
(Loops/With multiple ranges en Yabasic)
(Loops/With multiple ranges en True BASIC)
Line 2,111: Line 2,111:
<lang smalltalk>** arg
<lang smalltalk>** arg
^ self raisedTo: arg</lang>
^ self raisedTo: arg</lang>


=={{header|True BASIC}}==
{{trans|FreeBASIC}}
<lang qbasic>
SUB process(x)
LET sum = sum + abs(x)
IF abs(prod) < (2 ^ 27) and x <> 0 then LET prod = prod * x
END SUB

LET prod = 1
LET sum = 0
LET x = 5
LET y = -5
LET z = -2
LET one = 1
LET three = 3
LET seven = 7

FOR j = -three to (3 ^ 3) step three
CALL process(j)
NEXT j
FOR j = -seven To seven Step x
CALL process(j)
NEXT j
FOR j = 555 to 550 - y
CALL process(j)
NEXT j
FOR j = 22 to -28 step -three
CALL process(j)
NEXT j
FOR j = 1927 to 1939
CALL process(j)
NEXT j
FOR j = x to y step z
CALL process(j)
NEXT j
FOR j = (11 ^ x) to (11 ^ x) + one
CALL process(j)
NEXT j
PRINT " sum= "; sum
PRINT "prod= "; prod
END
</lang>



=={{header|Vala}}==
=={{header|Vala}}==