Creating Variable in DLR (DLR Language - Part 2)
Tuesday, January 29th, 2008DLR Variable Assignment(Src & Binary)
Creating a variable is not an easy task in DLR. There are different types of variables and different issues (like binding, etc.). Let’s consider the easiest way of using variable.
The variable may be created inside CodeBlock. CodeBlock captures a block of code that should correspond to a .NET method body:
They we will create an Ast which writes value 3 to the variable (consider second red rectangle on the image).
The output of code above should be the following AST and result:
//
// AST
//
.codeblock Object Script ()() {
.var Int32 hello (Global,InParameterArray){
(.bound hello) = 3;
.return (.bound hello);
}
}
Result:3