Anonymous user
History variables: Difference between revisions
m
→{{header|Elena}}
Line 551:
</lang>
=={{header|Elena}}==
ELENA 3.
<lang elena>import extensions.
import system'collections.
import system'routines.
import extensions'routines.
class HistoryVariable
{
object prop Value :: _value.
▲ stack _previous := Stack new.
set Value:v
[
if (
[
_previous push(_value)
].
_value := v
]
undo
[
Line 579 ⟶ 580:
];
[
_value :=
]
]
enumerator => _previous.
}
[
var o := HistoryVariable new.
Line 594 ⟶ 595:
o Value := "foo".
o Value := o Value + "bar".
console printLine(o).
o forEach:printingLn.
o undo; undo; undo.
console printLine(o Value).
]
{{out}}
<pre>
|