Assigning Values to an Array: Difference between revisions

m
(rm JavaScript and LSE)
m (→‎Ruby: move to Arrays)
Line 514:
x[7] <- 99
</lang>
 
==[[Ruby]]==
{{works with|Ruby| 1.8.5}}
# To specify a value for a known index
# Usage: arr[index] = value
arr = 1,2,3,4,5
arr[0] = 10
 
# To push a value onto an array. This accepts single or multiple arguments:
arr.push( 1 )
arr.push( 1, 2, 3 )
 
# You can also use the << operator with one argument:
arr << 1
 
==[[Scala]]==
Anonymous user