On 6/17/20 4:46 PM, Denis wrote:> Is there a cleaner way to implement an "if not" condition check?

> if ( configfile.isFile && configfile.extension == ".conf", message ) { }
>    else <handle it>

  if (isConfigFile(name)) {
    // ...

  } else {
    // ...
  }

The following is suitable in many cases:

  enforce(isConfigFile(name), format!"%s is not a config file"(name));
  // ...

I shortened that in many occasions:

  enforceConfigFile(name);
  // ...

Of course, depending on the situation it is assert() or assertConfigFile().

Ali

Reply via email to