Why is creating of if Expressions not allowed?

sighoya sighoya at gmail.com
Sun Mar 24 16:18:49 UTC 2019


Why

auto GenIf()()
{
     return mixin("if(true) { return true;} else {return false;}");
}

public bool testFunction2()
{
     GenIf!();
}


gives me:

onlineapp.d-mixin-3(3): Error: expression expected, not if
onlineapp.d(8): Error: template instance `onlineapp.GenIf!()` 
error instantiating




More information about the Digitalmars-d-learn mailing list