rewrite to `else if not`