in reply to Re: Code blocks with ternary operator or trailing conditionals
in thread Code blocks with ternary operator or trailing conditionals

Indeed, I have tried these in the past -- but:
1. The 'and' method requires one to be very careful about return values -- making sure you have the logic right the first time and that the logic never changes or has exceptions (as you and others have pointed out).
2. The comma method is great (and even works with the ternary operator, if you use parentheses similar to how you did when using 'and'). However, this only works with scalar statements and can create real issues/confusion with operators that can operate on lists (like print).

So thanks for showing these options -- even though I have mostly shied away from them -- due to the syntax/grammer issues you and others have raised. Thanks!!!
  • Comment on Re^2: Code blocks with ternary operator or trailing conditionals