Inspectopedia
 
2024.3

'case' statement without 'else' block

Warning
New
Last modified: 03 December 2024

Reports case statements without else blocks. An else block should always be present to specify the default result if no match is found.

Example:

A quick-fix is available to insert an else block. After the quick-fix is applied, the result looks like this:

Inspired by 'Roodi'