5 February 2012

Ternary Operator and Other Shorthand Code

The ternary operator is a shorthand way of writing an if/else statement where a particular action occurs in both cases, but the value associated with that action depends on the condition stated. For example, the traditional if/else construct (C/Java/JavScript syntax): can be rewitten as: This in itself is a huge benefit to clean, concise code. […]