randomphobia Posted December 15, 2012 Share Posted December 15, 2012 (edited) How do you hold several different variables in one variable in scar since that's probably confusing wording here's examples from other languages: Python (suppose it would be a list): list = ['1st Variable','2nd Variable','3rd Variable','4th Variable'] C++ (array or vector) int array [4] = {1,2,3,4}; Edited December 15, 2012 by randomphobia Quote Link to comment Share on other sites More sharing options...
LordJashin Posted December 15, 2012 Share Posted December 15, 2012 Check out the wiki or tutorials. Its all right there. Tutorial section on forums. [scar] program New; var Arr1: array[1..5] of Integer; // only goes from 1 to 5 on array STATIC array Arr2: array of Integer; // array of integer DYNAMIC ARRAY Arr3: TIntArray; // Same thing as Arr2 same type DYNAMIC array begin Arr1[1] := 5; Arr2 := [1,2,3]; Arr3 := [1]; end. [/scar] Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted December 15, 2012 Share Posted December 15, 2012 (edited) In Pascal arrays are defined as: MyVar: array of <datatype>; The 1st item in the above array is MyVar[0]. If you wanted to specify the lower and upper bounds of the array: MyVar: array [4..7] of <datatype>; Freddy has predefined some datatypes for ease of coding. TIntArray - array of Integer, TStrArray - array of string, etc. So to take your 2nd example: var MyVar: TIntArray; begin MyVar := [1,2,3,4]; // Or you could do this... SetLength(MyVar, 4); MyVar[0] = 1; MyVar[1] = 2; MyVar[2] = 3; MyVar[3] = 4; end; Edit: Ninja'd again. Edited December 15, 2012 by Bixby Sayz Quote Link to comment Share on other sites More sharing options...