Time for action—Assigning to Dynamic variables

When you declare a variable as being Dynamic, you will be able to assign any value to it at compile time. So you can actually compile this code:

class DynamicTest
{
public static function main()
{
var dynamicVar : Dynamic;
dynamicVar = "Hello";
dynamicVar = 123;
dynamicVar = {name:"John", lastName : "Doe"};
dynamicVar = new Array<String>();
}
}

The compiler won't mind even though you are assigning values with different types to the same variable!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.218.221