Ruby:Creating an Array
From Progzoo
Ruby:Creating an Array
Contents |
Create an Array Literal
You can initialise the array to a specific list of values:
[Font]
[Default]
[Show]
[Resize]
[History]
[Profile]
Repeating an Array
If you want to create an array of a certain length all filled with the same value, for example, you can repeat an array by using the multiplication operator:
[Font]
[Default]
[Show]
[Resize]
[History]
[Profile]
Create a two dimensional Array Literal
You can initialise the array to a specific list of values:
[Font]
[Default]
[Show]
[Resize]
[History]
[Profile]
Create a String Array using split
The split method can be useful for creating string array:
[Font]
[Default]
[Show]
[Resize]
[History]
[Profile]
