New operator (SDT)

Official Content
This documentation is valid for:

To return a new initialized instance of SDT variable.

Syntax

&Var = New SDTName()

or

&Var = New()  //if rename the SDT, you don't need to change the source.

Where:

&Var
   It’s a variable based on SDT

SDTName()
   It’s the name of a collection SDT or item (regardless of the variable data type)

The operator should be used when adding elements to an SDT collection.

Note

It is possible to include an SDN Name from the Insert/SDT option (or with ctrl. + Space). 

Example

For each 
    &A.CliName = CliName
    &A.CliAdd = CliAdd
    &ClientList.Add(&A)
    &A = New Client() 
EndFor

The first new is implicit when defining a variable.  It is not necessary to use the command at the begining of the for each.

Scope

Objects Structured Data Type (SDT) object
Languages .NET, Java, Ruby, Visual FoxPro
   

See also

Clone Method

More details

Structured Data Type