Weird Ruby: Begin-End Blocks(blog.newrelic.com)5 points·by tkrajcar·12 yıl önce·1 commentsblog.newrelic.comWeird Ruby: Begin-End Blockshttp://blog.newrelic.com/2014/11/13/weird-ruby-begin-end/1 commentsPost comment[–]MrBra·12 yıl öncereplyI think this post-condition (begin-end while) loop is really similar to that of many other common languages.For example in both Java and Javascript you have:do { statement(s) } while (expression);which will execute the code in the block at least once.Why in Ruby would that be much of a surprise then?The only difference is that in Ruby you use "begin-end" (and not "do-end" which can be used to create a block only in some contextes).Please correct me if I am wrong.
For example in both Java and Javascript you have:
do {
} while (expression);
which will execute the code in the block at least once.
Why in Ruby would that be much of a surprise then?
The only difference is that in Ruby you use "begin-end" (and not "do-end" which can be used to create a block only in some contextes).
Please correct me if I am wrong.