Monday, October 29, 2012

List


static void Collection_List(Args _args)
{
    // Create a new list of type string
    List names = new List (Types :: String);
    ListEnumerator listE;

    ;
    // Add elements to the list
    names.addEnd ("Lucas");
    names.addEnd ("Jennifer");
    names.addEnd ("Peter");

    // Display the content of the list
    info (names.toString());
    // Get the enumerator of the list
    // to loop through it
    listE = names.getEnumerator();
    while (listE.moveNext())
  {
        info ( strfmt ("Name: %1", listE.current()));
  }
}

No comments: