Anonymous user
Loops/With multiple ranges: Difference between revisions
→{{header|Smalltalk}}
Line 1,765:
As another alternative to the first solution above, we can loop over the ranges. This avoids the concatenations and generation of the intermediate big collection (which does not really make a difference here, but would, if each collection consisted of millions of objects):
{{works with|Smalltalk/X}}<lang smalltalk>...
{
(three negated to: 3**3 by: three ) .
Line 1,781:
].
...</lang>
Notice: this creates only 8 objects and also
{{out}}
<pre> sum = 348173
|