Use the EGL new operator to dynamically create storage of a specified type. If you are creating a reference type variable, new creates a reference to the storage; otherwise it creates the storage itself.
You can specify a set-value block with the new operator. Note that a set-value block automatically turns off the null flag for a nullable variable. For more information, see Set-value blocks. For examples, see "When to use the new operator" in this topic.
func( new Dictionary{ key1 = 3, key2 = "Hello", key3 = false } );
record CustomerArray myCustomers CustomerRec[] = [ new CustomerRec { idNum = 101 }, new CustomerRec { idNum = 102 } ]; end
The alternative, declaring CustomerRec variables to put in the array, is impossible. A initializer for the record cannot access any variables other than the fields within that record.
myInt INT = new INT;
myInt INT;
When you use the new operator, storage is reserved twice. First the left hand side of the assignment creates storage for an INT and names it myInt. Then the new operator creates a second INT, and assigns its value to the first. The second INT is not used again.
myInt INT? = new INT;
myInt INT?{};