A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
35
Task/History-variables/Smalltalk/history-variables.st
Normal file
35
Task/History-variables/Smalltalk/history-variables.st
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
Object subclass:'HVar'
|
||||
instanceVariableNames:'values'
|
||||
classVariableNames:''
|
||||
poolDictionaries:''
|
||||
category:'example'.
|
||||
!
|
||||
|
||||
!HVar methodsFor:'accessing'!
|
||||
|
||||
<-- value
|
||||
(values ifNil:[values := OrderedCollection new]) add:value.
|
||||
^ value
|
||||
!
|
||||
|
||||
value
|
||||
^ values last
|
||||
!
|
||||
|
||||
undo
|
||||
values removeLast.
|
||||
!
|
||||
|
||||
history
|
||||
^ history
|
||||
! !
|
||||
|
||||
|x|
|
||||
|
||||
x := HVar new.
|
||||
x <-- 1.
|
||||
x value.
|
||||
x <-- 2.
|
||||
x <-- (x value + 1).
|
||||
x value.
|
||||
x history.
|
||||
Loading…
Add table
Add a link
Reference in a new issue