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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Test your Ruby Blocks knowledge with this quiz we built

1 点作者 rishtal超过 10 年前

1 comment

hackerboos超过 10 年前
Some of your questions are wrong:<p><pre><code> irb(main):001:0&gt; data = [1,2] =&gt; [1, 2] irb(main):002:0&gt; total = 10 =&gt; 10 irb(main):003:0&gt; data.each { |x| total += x } =&gt; [1, 2] irb(main):004:0&gt; puts total 13 =&gt; nil </code></pre> ===<p><pre><code> What is proper syntax for a block? A. { |x| puts x } B. do |x| puts x end C. -&gt;(x) { puts x} D. A &amp; B E. B &amp; C F. A &amp; C </code></pre> I answered A &amp; B which your quiz says is wrong.<p>You might want to read this and rewrite your quiz...<p><a href="http://awaxman11.github.io/blog/2013/08/05/what-is-the-difference-between-a-block/" rel="nofollow">http:&#x2F;&#x2F;awaxman11.github.io&#x2F;blog&#x2F;2013&#x2F;08&#x2F;05&#x2F;what-is-the-diffe...</a>