Why is creating of if Expressions not allowed?

sighoya sighoya at gmail.com
Sun Mar 24 18:54:27 UTC 2019


On Sunday, 24 March 2019 at 18:43:51 UTC, Paul Backus wrote:
> You can't return the result of a string mixin from a function. 
> Instead, return a string from your `GenIf` function, and mix it 
> in at the call site:
>
> string GenIf()
> {
>     return "if (true) { return true; } else { return false; }";
> }
>
> bool testFunction()
> {
>     mixin(GenIf());
> }

Thanks for mentioning this, this was where I looking for.


More information about the Digitalmars-d-learn mailing list