Retrieving an Element of an Array: Difference between revisions

no edit summary
No edit summary
Line 6:
 
=={{header|ActionScript}}==
<lang actionscript>
var arr:Array = new Array(1,2,3);
var myVar:Number = arr[1];
// the value of myVar is: 2
</lang>
</actionscript>
 
=={{header|Ada}}==
Array indexed by an enumerated type. Ada enumerated types are discrete non-numeric types.
<lang ada>
type Days is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
type Daily_Counts is array(Days) of Natural;
Line 20:
Monday_Sales : Natural;
Monday_Sales := This_Week(Mon);
</adalang>
Monday_Sales is assigned 200
 
Line 222:
=={{header|J}}==
 
Arrays are the only way J handles data, so every program that produces a portion of a given array is relevant here. In these few examples emphasis is on the primary verb <codett>{</codett> ("from").
 
The natural unit of access in J is the item. (Every piece of data can be treated as a list of [zero or more] items):