daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest May 16th, 2018 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. a = Array.new(6)
  2. 0.upto(5){ |i|
  3.   a[i] = i
  4. }
  5.  
  6. b = []
  7. 0.upto(5){ |i|
  8.   b += [i]
  9. }
  10.  
  11. c = (0..5).to_a
  12.  
  13.  
  14. [a, b, c].each do |i|
  15.   print "#{i.class}\t#{i.length}\t#{i.inspect}\n"
  16. end
  17.  
  18. __END__
  19.  
  20. Results:
  21.  
  22. Array 6 [0, 1, 2, 3, 4, 5]
  23. Array   6   [0, 1, 2, 3, 4, 5]
  24. Array   6   [0, 1, 2, 3, 4, 5]
RAW Paste Data
Top