1 module orelang.operator.WhenOperator; 2 import orelang.operator.IOperator, 3 orelang.Engine, 4 orelang.Value; 5 6 class WhenOperator : IOperator { 7 /** 8 * Loop while the condition is true. 9 */ 10 public Value call(Engine engine, Value[] args) { 11 if (engine.eval(args[0]).getBool) { 12 Value ret = null; 13 14 foreach (arg; args[1..$]) { 15 ret = engine.eval(arg); 16 } 17 18 return ret; 19 } else { 20 return new Value; 21 } 22 } 23 }