RosettaCodeData/Task/Dynamic-variable-names/Elena/dynamic-variable-names.elena

26 lines
516 B
Plaintext

#import system.
#import system'dynamic.
#import extensions.
#class TestClass
{
#field theVariables.
#constructor new
[
theVariables := DynamicStruct new.
]
#method eval
[
#var(type:subject) varRef := Signature new &literal:(console write:"Enter the variable name:" readLine).
theVariables::varRef set:42.
#var v := theVariables::varRef get.
console writeLine:(varRef name):"=":(theVariables::varRef get).
]
}
#symbol program = TestClass new.