3 回答

TA貢獻(xiàn)1873條經(jīng)驗(yàn) 獲得超9個(gè)贊
注意:
該begin <code> end while <condition>由Ruby的作者M(jìn)atz的拒絕。相反,他建議使用Kernel#loop,例如
loop do
# some code here
break if <condition>
end
這是2005年11月23日的電子郵件交流,其中Matz說:
|> Don't use it please. I'm regretting this feature, and I'd like to
|> remove it in the future if it's possible.
|
|I'm surprised. What do you regret about it?
Because it's hard for users to tell
begin <code> end while <cond>
works differently from
<code> while <cond>
RosettaCode Wiki具有類似的故事:
在2005年11月,Ruby的創(chuàng)建者M(jìn)atsuki Yukihiro Matsumoto對(duì)這個(gè)循環(huán)功能感到遺憾,并建議使用Kernel#loop。
- 3 回答
- 0 關(guān)注
- 737 瀏覽
添加回答
舉報(bào)