How to check for combinations of versions

Dennis dkorpel at gmail.com
Wed May 5 15:26:43 UTC 2021


On Wednesday, 5 May 2021 at 15:03:16 UTC, Blatnik wrote:
> Is there any way to check for multiple conditions in a 
> `version` statement?

No, and that's by design to discourage complex version logic.
The recommended approach is:

```D
version (Version_A) version = Cool_Feature_Supported;
version (Version_B) version = Cool_Feature_Supported;

void do_something_cool() {
   version(Cool_Feature_Supported) {
     ...
   } else {
     ...
   }
}

```



More information about the Digitalmars-d-learn mailing list