What is the “right” way to iterate through an array in Ruby?

后端 未结 12 1758
盖世英雄少女心
盖世英雄少女心 2020-12-04 04:18

PHP, for all its warts, is pretty good on this count. There\'s no difference between an array and a hash (maybe I\'m naive, but this seems obviously right to me), and to ite

12条回答
  •  一个人的身影
    2020-12-04 04:57

    The right way is the one you feel most comfortable with and which does what you want it to do. In programming there is rarely one 'correct' way to do things, more often there are multiple ways to choose.

    If you are comfortable with certain way of doings things, do just it, unless it doesn't work - then it is time to find better way.

提交回复
热议问题