Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

Ruby Array.new syntax

Array.new( number of indices, value of the indices ) { optional block for value of indices }

ary = Array.new    #=> []
Array.new(3)       #=> [nil, nil, nil]
Array.new(3, true) #=> [true, true, true]
Array.new(3) { Hash.new } #=> [ {}, {}, {} ]
Source by ruby-doc.org #
 
PREVIOUS NEXT
Tagged: #Ruby #syntax
ADD COMMENT
Topic
Name
8+5 =