1
$\begingroup$

Inspired by his previous discovery, the lazy software engineer decided to look for more interesting snippets in his company's code repository. After searching for a while, he found this one:

int main()
{
    int have = 1;
    int eat = 1;

    bool can = true;

    if (have && eat)
    {
        can = false;
    }
}

After failing again to extract any meaning from this snippet, the lazy software engineer headed over to Puzzling.SE to try and figure out a solution.

What famous idiom does this code snippet represent?

$\endgroup$
2
  • $\begingroup$ (The comments made on the "previous discovery" puzzle are applicable here as well. This is less "puzzle" and more "what common phrase contains these keywords", and is, well, too obvious to be particularly interesting. I like this idea, but there needs to be something to solve, not merely something to recognize and identify.) $\endgroup$
    – Rubio
    Commented Mar 23, 2018 at 14:38
  • $\begingroup$ @Rubio I get that. I am trying to move my puzzles towards something that doesn't explicitly mention too many parts of the phrase. I am learning, so I will make my next puzzle harder to solve and more of a puzzle versus just a simple giveaway. $\endgroup$ Commented Mar 23, 2018 at 14:41

1 Answer 1

7
$\begingroup$

It's:

You can't have your cake AND eat it too.

Because:

If both Have and Eat are equal to one, the boolian "Can" is set to false, i.e Cannot.

So if you attempt to "Have" and "Eat", you cannot, which relates to the phrase "You cannot have your cake and eat it too."

$\endgroup$
3
  • $\begingroup$ Well done, but can you explain why? $\endgroup$
    – Azync
    Commented Mar 23, 2018 at 13:16
  • $\begingroup$ @Azync The reasoning is fairly self-explanatory. $\endgroup$ Commented Mar 23, 2018 at 13:17
  • $\begingroup$ I did begin to type a "Because" section, but if I'm honest it did seem a bit self-evident $\endgroup$ Commented Mar 23, 2018 at 13:18

Your Answer

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

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