[Solved] Shorthand ‘if’ is throwing a syntax error
The Python if ternary operator syntax requires an else, like so: x = 2 if y < 5 else 4 solved Shorthand ‘if’ is throwing a syntax error
The Python if ternary operator syntax requires an else, like so: x = 2 if y < 5 else 4 solved Shorthand ‘if’ is throwing a syntax error
You could do a = !a && val1 if you dont mind switching between false and val1. This is based on the behaviour of && operator in javascript: if first operand is true && operator assigns the second operand, else it returns first operand. Please note: This does make your code more difficult to read. … Read more