using function with recursion: (tail call will be optimized;))
void whileLoop(bool delegate() cond,void delegate() fun){
if(cond()){
fun();
whileLoop(cond,fun);
}
}
should use closure
or always using excessively / underutilized goto
startloop:if(!condition)goto endloop;
goto startloop;
endloop:;
source
share