Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Weird Ruby: Begin-End Blocks.
For example in both Java and Javascript you have:
do {
statement(s)
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.
There are no comments on this comment yet.
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.