ã™ã”ãåˆæ©çš„ã§ã™ãŒã€æ–°å¹´ä¸€ç™ºç›®ã®ã‚¨ãƒ³ãƒˆãƒªã¯åŽ»å¹´ã®ç©ã¿æ®‹ã—ã‹ã‚‰ã€‚ each [1] pry(main)> def each_sample [1] pry(main)* (1..10).to_a.each do |i| [1] pry(main)* piyo = i + 1 [1] pry(main)* end [1] pry(main)* end => :hoge [2] pry(main)> hoge = each_sample() => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] http://ref.xaio.jp/ruby/classes/array/each eachメソッドã¯ã€é…列ã®è¦ç´ ã®æ•°ã ã‘ブãƒãƒƒã‚¯ã‚’ç¹°ã‚Šè¿”ã—実行ã—ã¾ã™ã€‚ç¹°ã‚Šè¿”ã—ã”ã¨ã«ãƒ–ãƒãƒƒã‚¯å¼•æ•°ã«ã¯å„è¦ç´ ãŒé †ã«å…¥ã‚Šã¾ã™ã€‚戻り値ã¯ãƒ¬ã‚·ãƒ¼ãƒè‡ªèº«ã§ã™ã€‚ レシーãƒè‡ªèº« ãŒè¿”ã‚‹ã®ã§ã€ã„ãらä¸ã§ piyo ã«ä»£å…¥ã—ãŸ
{{#tags}}- {{label}}
{{/tags}}