This are examples from library documentation
(1…10).each_slice(3) {|a| p a}
(1…10).each_cons(3) {|a| p a}
but when I run them in fxri, got such errors:
undefined method `each_slice’ for 1…10:Range
Do I need to require any module?
This are examples from library documentation
(1…10).each_slice(3) {|a| p a}
(1…10).each_cons(3) {|a| p a}
but when I run them in fxri, got such errors:
undefined method `each_slice’ for 1…10:Range
Do I need to require any module?
On 13.10.2007 11:25, Liang He wrote:
This are examples from library documentation
(1…10).each_slice(3) {|a| p a}
(1…10).each_cons(3) {|a| p a}but when I run them in fxri, got such errors:
undefined method `each_slice’ for 1…10:Range
Do I need to require any module?
Yes, enumerator.
robert
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs