The CodeBuilder to use.
The name of the variable's type.
The name of the variable.
The CodeFunc which generates the code to set the variable's intial value.
A Variable describing the variable declared by this function.
auto builder = new CodeBuilder(); // Declare the variable without setting it. auto six = builder.addVariable("int", "six"); builder.data.should.equal("int six;\n"d); six.should.equal(Variable("int", "six")); builder = new CodeBuilder(); // Declare the variable, and set it's value. CodeFunc func = (b){b.put("6");}; six = builder.addVariable("int", "six", func); builder.data.should.equal("int six = 6;\n"); six.should.equal(Variable("int", "six", func));
Declares a variable, and returns a Variable which can be used to easily reference the variable.
Notes: valueFunc may be null.