Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Cancel
4
  • unclear why you expect ++y as output. I could understand --y, but ++y is part of the condition not the output Commented Jul 28, 2021 at 13:28
  • Write it like this: (1 ? ++x, ++y : (--x, --y)). That ought to do what you're looking for. The grouping here is a bit peculiar, as the current answer indicates. Commented Jul 28, 2021 at 13:31
  • @463035818_is_not_a_number: OP expects 1 ? (++x, ++y) : (--x, --y)...
    – Jarod42
    Commented Jul 28, 2021 at 13:31
  • @Jarod42 oh well, I completely misread the conditional. Its a nice way to write unreadable code ;) Commented Jul 28, 2021 at 13:34