As you can see, what before was 8 lines of code has been reduced to one line. You can potentially reduce the if-else statement down to 2 lines of code and maintain readability, however to reduce it down to 1 line would make your code a lot less readable (and be bad programming practice in my opinion).

The ternary operator can also be nested so that different conditions can be tested based on a result of true. This is where you can get into trouble formatting and lose readability. We dig into the proper formatting later on.