Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.9.3p385 :001 > a=[[1,2,3],[4,5,6],[7,8,9]]
- => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
- 1.9.3p385 :002 > a.each_with_index do |row, index, myrow=[], in_block=false|
- 1.9.3p385 :003 > p "class: #{row.class}"
- 1.9.3p385 :004?> p "value: #{row}"
- 1.9.3p385 :005?> end
- "class: Array"
- "value: [1, 2, 3]"
- "class: Array"
- "value: [4, 5, 6]"
- "class: Array"
- "value: [7, 8, 9]"
- => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
- ########################################################
- 1.9.3p385 :006 > a=[[1,2,3],[4,5,6],[7,8,9]]
- => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
- 1.9.3p385 :007 > a.each do |row, myrow=[], in_block=false|
- 1.9.3p385 :008 > p "class: #{row.class}"
- 1.9.3p385 :009?> p "value: #{row}"
- 1.9.3p385 :010?> end
- "class: Fixnum"
- "value: 1"
- "class: Fixnum"
- "value: 4"
- "class: Fixnum"
- "value: 7"
- => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
- #######################################################
- 1.9.3p385 :011 > a=[[1,2,3],[4,5,6],[7,8,9]]
- => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
- 1.9.3p385 :012 > a.each do |row|
- 1.9.3p385 :013 > p "class: #{row.class}"
- 1.9.3p385 :014?> p "value: #{row}"
- 1.9.3p385 :015?> end
- "class: Array"
- "value: [1, 2, 3]"
- "class: Array"
- "value: [4, 5, 6]"
- "class: Array"
- "value: [7, 8, 9]"
- => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Advertisement
Add Comment
Please, Sign In to add comment