TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Weird Ruby: Begin-End Blocks

5 点作者 tkrajcar超过 10 年前

1 comment

MrBra超过 10 年前
I think this post-condition (begin-end while) loop is really similar to that of many other common languages.<p>For example in both Java and Javascript you have:<p>do {<p><pre><code> statement(s) </code></pre> } while (expression);<p>which will execute the code in the block at least once.<p>Why in Ruby would that be much of a surprise then?<p>The only difference is that in Ruby you use &quot;begin-end&quot; (and not &quot;do-end&quot; which can be used to create a block only in some contextes).<p>Please correct me if I am wrong.