打印

1.90版的string不支持each?

1.90版的string不支持each?

不知道为什么,ruby1.90的string不支持each方法了,我是windowsxp,1.86版就没有问题。

TOP

1.9中String没有include Enumerable,所以不能迭代了。

关注Ruby1.9,请留意这一帖http://www.ruby-lang.org.cn/forums/thread-3189-1-1.html,会在2月份以内完成Ruby1.9变化的翻译。
###
blog => red_world,
mail => [image]http://services.nexodyne.com/email/icon/NTbKP7EQRA%3D%3D/c2n6Sgw%3D/R01haWw%3D/0/image.png[/image]
###

TOP

多谢

今天发现
这些语法都不能用了
1.upto(9) {|i| print i if i<7 }  #123456
9.downto(1) {|i| print i if i<7 }  #654321
(1..9).each {|i| print i if i<7}  #123456
0.step(11,3) {|i| print i }    #0369

TOP

回复 #3 biozzy 的帖子

这些怎么不能用了?我用着挺好啊

TOP

2008-12-05 05:16 Crawled by CCBot/1.0 (+http://www.commoncrawl.org/bot.html) @38.103.63.61