Question
· Jul 13, 2021

Initialise object list

How do you initialise a list of objects of a particular type?

I have tried the following code and I get an undefined when I try to insert.

I can do this and it works but I don't know if it is correct.

 

Is there any way to do something like this?

Set a= New list of Accciones()

Thank you.

Product version: Caché 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.4 (Build 505_1) Thu May 28 2020 10:12:49 EDT
Discussion (3)2
Log in or sign up to continue

The #Dim is a precompiler directive and not a statement.  Objectscript is a type-less language.  The #dim directive only assigns a type to a variable which enables capabilities like Intellisense.  

The Creation, with the %New(), that you do in the second method is necessary since the list object does not actually exist before that.