Loops/With multiple ranges: Difference between revisions
Content added Content deleted
(→{{header|Smalltalk}}: an alternative (better ?)) |
|||
Line 1,706: | Line 1,706: | ||
=={{header|Smalltalk}}== |
=={{header|Smalltalk}}== |
||
Ranges (called ''Interval'' in Smalltalk) are collections, which - like all collections - can be concatenated with the <tt>,</tt> (comma) message: |
Ranges (called ''Interval'' in Smalltalk) are collections, which - like all collections - can be concatenated with the <tt>,</tt> (comma) message. Intervals are created by sending a <tt>to:</tt> or <tt>to:by:</tt> message to a magnitude-like thingy (i.e. other than numbers are possible): |
||
<lang smalltalk>prod := 1. |
<lang smalltalk>prod := 1. |
||
sum := 0. |
sum := 0. |