Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = Array.new(6)
- 0.upto(5){ |i|
- a[i] = i
- }
- b = []
- 0.upto(5){ |i|
- b += [i]
- }
- c = (0..5).to_a
- [a, b, c].each do |i|
- print "#{i.class}\t#{i.length}\t#{i.inspect}\n"
- end
- __END__
- Results:
- Array 6 [0, 1, 2, 3, 4, 5]
- Array 6 [0, 1, 2, 3, 4, 5]
- Array 6 [0, 1, 2, 3, 4, 5]
Add Comment
Please, Sign In to add comment