Creating an Array: Difference between revisions

Blanked page since people can't / don't read
(Blanked page since people can't / don't read)
 
(301 intermediate revisions by 92 users not shown)
Line 1:
{{taskDeprecatedTask}}
'''Please do not add new code, and merge existing code to the [[Arrays]] task.'''
 
This task is about numerically-indexed arrays. For '''hashes''' or '''associative arrays''', please see [[Creating an Associative Array]].
In this task, the goal is to create an [[array]].
 
In this task, the goal is to create an [[array]]. Mention if the [[array base]] begins at a number other than zero.
==[[mIRC]]==
In addition, demonstrate how to initialize an array variable with data.
'''Interpeter:''' mIRC Script Editor
'''Libraries:''' [[mArray Snippet]]
alias creatmearray { .echo -a $array_create(MyArray, 5, 10) }
 
==[[Visual Basic 2005.Net]]==
Dim myArray as new ArrayList
Dim myArray2 as new ArrayList = { "Item1", "Item2" }
 
==[[Quick Basic]]==
'''Interpeter:''' QB 4.5 or PB 7.1
'''Libraries:''' [[None are needed]]
 
' $DYNAMIC
DIM SHARED myArray(-10 TO 10, 10 TO 30) AS STRING
REDIM SHARED myArray(20, 20) AS STRING
myArray(1,1) = "Item1";
 
==[[Javascript]]==
var myArray = new Array();
var myArray2 = new Array("Item1","Item2");
 
==[[3DS Max 8 - MaxScript]]==
myArray = #()
myArray2 = #("Item1", "Item2")
 
 
==[[Python]]==
'''Interpeter:''' Python
'''Libraries:''' [[None are needed]]
Array=[
[0,0,0,0,0,0],
[1,1,1,1,1,1],
[2,2,2,2,2,2],
[3,3,3,3,3,3]
]
#You would call the array by this code. This will call the 3rd 1 on the second list
Array[1][3]}
 
==[[Perl]]==
'''Interpeter:''' Perl
'''Libraries:''' [[None are needed]]
 
@Array=(
[0,0,0,0,0,0],
[1,1,1,1,1,1],
[2,2,2,2,2,2],
[3,3,3,3,3,3]
);
#You would call the array by this code. This will call the 3rd 1 on the second list
print $Array[1][3];
 
# Alternative:
my @array_using_qw = qw/coffee sugar cream/;
 
==[[Ada]]==
'''Compiler:''' GCC 4.1.2
type Arr is array (Positive range <>) of Integer;
Uninitialized : Arr (1 .. 10);
Initialized_1 : Arr (1 .. 20) := (others => 1);
Initialized_2 : Arr := (1 .. 30 => 2);
Const : constant Arr := (1 .. 10 => 1, 11 .. 20 => 2, 21 | 22 => 3);
 
{{array operation}}
10,333

edits