更新时间:2023-11-12 21:30:46
根据 The Ruby Programming Language 书第 5.2.1 节:
According to The Ruby Programming Language book Section 5.2.1:
while
或 until
循环中的 do
关键字类似于if
语句:只要换行(或分号)出现在循环条件和循环体之间.
The
do
keyword in awhile
oruntil
loop is like thethen
keyword in anif
statement: it may be omitted altogether as long as a newline (or semicolon) appears between the loop condition and the loop body.
所以,不,它不会改变行为,它只是可选的语法.
So, no, it won't change the behavior, it's just optional syntax.