Skip to content

Prefer IS NOT to NOT IS

IF variable IS NOT INITIAL.
IF variable NP 'TODO*'.
IF variable <> 42.

Negation is logically equivalent but requires a “mental turnaround” that makes it harder to understand.

" anti-pattern
IF NOT variable IS INITIAL.
IF NOT variable CP 'TODO*'.
IF NOT variable = 42.

A more specific variant of Try to make conditions positive. Also as described in the section Alternative Language Constructs in the ABAP programming guidelines.

From SAP/styleguides under CC BY 3.0 — more details
Last updated on