11
$\begingroup$

The code snippet below in VBA contains all the clues to find an old movie quote. Who said it, and in what movie?

Public Function Try(Action as String)
   Select Case Action
      Case "Do"
         Msgbox("Just do it!")
      Case Else
         Msgbox("Don't do it!")
   End Select
End Sub

Hint:

Language of code isn't really relevant. Although an attempt to compile might put you on the right track.

$\endgroup$

1 Answer 1

13
$\begingroup$

Answer

"Do. Or do not. There is no try.". Yoda - Star Wars The Empire Strikes Back

Explanation:

The case handles 2 branches only. Do where it alerts "Just Do it". For any other value of Action it alerts "Don't do it". There is no other option.

$\endgroup$
6
  • $\begingroup$ I had a hunch it was too easy, but couldn't resist putting it up :) $\endgroup$ Mar 29, 2016 at 15:31
  • 1
    $\begingroup$ @TimCouwelier Indeed it was too easy. I haven't seen the movie (bow head in shame) and still know the quote and where is it from. :) $\endgroup$
    – Marius
    Mar 29, 2016 at 15:32
  • $\begingroup$ Can you explain the hint aswell? $\endgroup$ Mar 29, 2016 at 15:33
  • $\begingroup$ @TimCouwelier. Done. $\endgroup$
    – Marius
    Mar 29, 2016 at 15:34
  • 1
    $\begingroup$ Close, but I'll accept it anyway. The intended clue was in the name of the function 'try'. You build a return for a function try(), by having a statement 'try = "Just do it"'. No such statement would probably thrown an error, stating there's no return statement ('there is no try'). $\endgroup$ Mar 29, 2016 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.