redefined Integer<<timesRepeat:
This commit is contained in:
parent
8f00605804
commit
f45cde7ba7
@ -285,9 +285,7 @@ class Number(Magnitude)
|
|||||||
(* self < 0 ifTrue: [^-1].
|
(* self < 0 ifTrue: [^-1].
|
||||||
self > 0 ifTrue: [^1].
|
self > 0 ifTrue: [^1].
|
||||||
^0.*)
|
^0.*)
|
||||||
^if (self < 0) { -1 }
|
^if (self < 0) { -1 } elsif (self > 0) { 1 } else { 0 }
|
||||||
elsif (self > 0) { 1 }
|
|
||||||
else { 0 }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +293,10 @@ class(#limited) Integer(Number)
|
|||||||
{
|
{
|
||||||
method timesRepeat: aBlock
|
method timesRepeat: aBlock
|
||||||
{
|
{
|
||||||
1 to: self by: 1 do: [ :count | aBlock value ].
|
## 1 to: self by: 1 do: [ :count | aBlock value ].
|
||||||
|
| count |
|
||||||
|
count := 0.
|
||||||
|
while (count < self) { aBlock value. count := count + 1 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user