Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

combined X and Y in XY

  • Loading branch information...
commit 56b9cdc5af1f293c55916aff2a178fe23234bea9 1 parent e278973
@dgruntz authored
Showing with 13 additions and 11 deletions.
  1. +13 −11 puzzlers/pzzlr-010.html
View
24 puzzlers/pzzlr-010.html
@@ -18,35 +18,37 @@
<div class="code-snippet">
<h3>What does the following code print?</h3>
<pre class="prettyprint lang-scala">
-object X {
- val value: Int = Y.value + 1
-}
-object Y {
- val value: Int = X.value + 1
+object XY {
+ object X {
+ val value: Int = Y.value + 1
+ }
+ object Y {
+ val value: Int = X.value + 1
+ }
}
-if(math.random > 0.5) X.value else Y.value
+if(math.random > 0.5) XY.X.value else XY.Y.value
</pre>
<ol>
<li>
-The program prints always <tt>1</tt>.
+Always prints <tt>1</tt>.
</li>
<li id="correct-answer">
-The program prints always <tt>2</tt>.
+Always prints <tt>2</tt>.
</li>
<li>
-The program prints (nondeterministicly) either <tt>1</tt> or <tt>2</tt>.
+Nnondeterministicly prints either <tt>1</tt> or <tt>2</tt>.
</li>
<li>
-The code fails with a compilation error.
+Fails with a compilation error.
</li>
<li>
-The code fails at runtime with a <tt>StackOverflowError</tt>.
+Fails at runtime with a <tt>StackOverflowError</tt>.
</li>
</ol>

4 comments on commit 56b9cdc

@demobox

Looks good to go! I'll just double-check with Nermin...@nermin ?

@demobox

Can you resend the pull request? Hopefully that will include the new commit. And +1 on the revised 4th answer...

@dgruntz
Owner
@demobox

Weird. The old pull request updated automatically just fine when you added the commits that removed the ' characters. And your latest commit indeed is on the branch that you used to create the pull request. Perhaps the quickest will just be to (sigh) simply close this pull request and submit a new one.

Please sign in to comment.
Something went wrong with that request. Please try again.