How to mixin repeated text?
Andrey
saasecondbox at yandex.ru
Mon Aug 27 11:52:02 UTC 2018
Hello again,
I have this part of code:
> ...
>if(index + 3 >= data.length || data[index + 1][0] == '&' ||
>data[index + 2][0] == '&' || data[index + 3][0] == '&' ||
>data[index + 4][0] == '&')
>{
> writeln("Some text...");
>}
I don't want to write manually these four "or" conditions because
in each case I know at compile time how many conditions should be.
I would be great if I could do something like this:
>if(index + 3 >= data.length || mixin OrCondition!4) { ... }
where "OrCondition" will insert text using this expression:
> data[index + j][0] == '&' // j is between [1 and 4]
I know that it is possible but don't know how to implement...
More information about the Digitalmars-d-learn
mailing list