Programmer Guide > Working with Lists and Associative Arrays > Defining a List
  

Defining a List
Use the LIST function to create a list:
result = LIST(expr1 ,..., exprn)
where expr1 , ..., exprn are expressions or variables. These expressions or variables are the elements of the list array.
The elements of a list can be any of the nine basic PV‑WAVE data types, other structures or arrays of structures, and other lists or associative arrays. In addition, lists and associative arrays can be used as structure fields.
Example
A list is created using the LIST function. The elements in the list do not have to have the same data type.
lst = LIST(1B, 2.2, '3.3', {,a:1, b:lindgen(2)}) 
The INFO command shows the contents of the list.
INFO, lst, /Full
; PV-WAVE prints the following:
; LST  LIST = List(4)
; BYTE  = 1
; FLOAT   = 2.20000
; STRING   = '3.3'
; STRUCT   = ** Structure $1, 2 tags, 24 length:
; A  INT 1
; B  LONG Array(2)
The PRINT command also shows the contents of the list.
PRINT, lst
; PV-WAVE prints: {   1    2.200003.3{    1    0    1}

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.