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?

  • $\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 Mar 23 '18 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$ – Arnav Borborah Mar 23 '18 at 14:41


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


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."

  • $\begingroup$ Well done, but can you explain why? $\endgroup$ – Azync Mar 23 '18 at 13:16
  • $\begingroup$ @Azync The reasoning is fairly self-explanatory. $\endgroup$ – Arnav Borborah Mar 23 '18 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$ – Fifth_H0r5eman Mar 23 '18 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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