Guest User

Untitled

a guest
Sep 1st, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1.  
  2.  
  3. 1.9.3p385 :001 > a=[[1,2,3],[4,5,6],[7,8,9]]
  4. => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
  5. 1.9.3p385 :002 > a.each_with_index do |row, index, myrow=[], in_block=false|
  6. 1.9.3p385 :003 > p "class: #{row.class}"
  7. 1.9.3p385 :004?> p "value: #{row}"
  8. 1.9.3p385 :005?> end
  9. "class: Array"
  10. "value: [1, 2, 3]"
  11. "class: Array"
  12. "value: [4, 5, 6]"
  13. "class: Array"
  14. "value: [7, 8, 9]"
  15. => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
  16.  
  17. ########################################################
  18.  
  19. 1.9.3p385 :006 > a=[[1,2,3],[4,5,6],[7,8,9]]
  20. => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
  21. 1.9.3p385 :007 > a.each do |row, myrow=[], in_block=false|
  22. 1.9.3p385 :008 > p "class: #{row.class}"
  23. 1.9.3p385 :009?> p "value: #{row}"
  24. 1.9.3p385 :010?> end
  25. "class: Fixnum"
  26. "value: 1"
  27. "class: Fixnum"
  28. "value: 4"
  29. "class: Fixnum"
  30. "value: 7"
  31. => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
  32.  
  33. #######################################################
  34.  
  35. 1.9.3p385 :011 > a=[[1,2,3],[4,5,6],[7,8,9]]
  36. => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
  37. 1.9.3p385 :012 > a.each do |row|
  38. 1.9.3p385 :013 > p "class: #{row.class}"
  39. 1.9.3p385 :014?> p "value: #{row}"
  40. 1.9.3p385 :015?> end
  41. "class: Array"
  42. "value: [1, 2, 3]"
  43. "class: Array"
  44. "value: [4, 5, 6]"
  45. "class: Array"
  46. "value: [7, 8, 9]"
  47. => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Advertisement
Add Comment
Please, Sign In to add comment