Browse files

combined X and Y in XY

  • Loading branch information...
1 parent e278973 commit 56b9cdc5af1f293c55916aff2a178fe23234bea9 @dgruntz committed May 31, 2012
Showing with 13 additions and 11 deletions.
  1. +13 −11 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
-The program prints always <tt>1</tt>.
+Always prints <tt>1</tt>.
<li id="correct-answer">
-The program prints always <tt>2</tt>.
+Always prints <tt>2</tt>.
-The program prints (nondeterministicly) either <tt>1</tt> or <tt>2</tt>.
+Nnondeterministicly prints either <tt>1</tt> or <tt>2</tt>.
-The code fails with a compilation error.
+Fails with a compilation error.
-The code fails at runtime with a <tt>StackOverflowError</tt>.
+Fails at runtime with a <tt>StackOverflowError</tt>.

4 comments on commit 56b9cdc

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

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


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.