The following statements loop through an associative array and display all its elements:

aTest = new AssocArray( )

aTest[ "USA" ] = "United States of America"

aTest[ "RUS" ] = "Russian Federation"

aTest[ "GER" ] = "Germany"

aTest[ "CHN" ] = "People's Republic of China"

cKey = aTest.firstKey // Get first key in AssocArray

// Get number of elements in AssocArray and loop through them

for nElements = 1 to aTest.count( )

   ? cKey // Display key name 

   ? aTest[ cKey ] // Display element value 

   cKey := aTest.nextKey( cKey ) // Get next key value 

endfor