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

23 lines
470 B
Text
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
import system'dynamic;
import extensions;
2016-12-05 22:15:40 +01:00
2017-09-23 10:01:46 +02:00
class TestClass
2016-12-05 22:15:40 +01:00
{
2019-09-12 10:33:56 -07:00
object theVariables;
2016-12-05 22:15:40 +01:00
2019-09-12 10:33:56 -07:00
constructor()
{
theVariables := new DynamicStruct()
}
2016-12-05 22:15:40 +01:00
2019-09-12 10:33:56 -07:00
closure()
{
2020-02-17 23:21:07 -08:00
auto prop := new MessageName(console.write:"Enter the variable name:".readLine());
(prop.setPropertyMessage())(theVariables,42);
2016-12-05 22:15:40 +01:00
2020-02-17 23:21:07 -08:00
console.printLine(prop.Printable,"=",(prop.getPropertyMessage())(theVariables)).readChar()
2019-09-12 10:33:56 -07:00
}
2016-12-05 22:15:40 +01:00
}
2019-09-12 10:33:56 -07:00
public program = new TestClass();