57) Interview questions

I’ve heard before that “What’s the worst code that you’ve seen recently?” is a common question in interviews for programming jobs, and it’s supposed to be a trick question where the only good answer is “My own”.

Today however, I’m providing you with an alternative. This is an actual line of code from something I bastardised, and I left no comment.

b=(c=c+p>0?c+p:0)>b?c:b

It’s not so bad though, the aim of the exercise was to have short code disregarding style. That’s probably the only place I would ever consider nesting a ternary operator in an assignment in a ternary operator in an assignment.