AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
Array typedict
 
An Array is a one-dimensional heterogeneous collection of objects. Elements in an array can be accessed by numeric index using familiar subscript or pointer notation:
array[0]     *array     array[i+j]     *(array+i+j)     
Array elements are uninitialized until they are assigned a value, either by an initializer in a declaration or by an explicit assignment statement. The first value assigned to an array element determines its type. Try to use an uninitialized element and you will get an undefined error.
 
 Example:   The program,
import yoix.stdio.*;

Array  a1[3];
a1[1] = "This is a test";
Array  a2[5] = {1, "hello", 0.5};
Array  a3 = {1, 2, new Array {3, 4}, new Object};

printf("a1=%O\na2=%O\na3=%.2O\n", a1, a2, a3);
creates three arrays, initializes some of the elements, and then prints
a1=Array[3:0]
   >--uninitialized--
    ^"This is a test"
    --uninitialized--
a2=Array[5:0]
   >1
    ^"hello"
    0.5
    --uninitialized--
    --uninitialized--
a3=Array[4:0]
   >1
    2
    Array[2:0]
       >3
        4
    NULL:POINTER
on standard output. Notice how we used the %O format to get a quick dump of the arrays and added precision to the format to get a full dump of the last array.
 
 See Also:   Dictionary, getArrayBands, Hashtable, isArray, String, Vector

 

Yoix is a registered trademark of AT&T Intellectual Property.