//IStatement public void Execute() { bool Condition = false; object obj = condition.Evaluate().GetData(); if (obj is bool) { Condition = (bool)obj; } else { throw new Exception("Not boolen expression in Loop statement"); } LoopStack.Push(); id = LoopStack.Id(); while (Condition) { block.Execute(); if (id > LoopStack.Id()) { break; } Condition = (bool)condition.Evaluate().GetData(); } }
public void Execute() { if (loop) { id = LoopStack.Id(); } foreach (var item in block) { item.Execute(); if (loop && id < LoopStack.Id()) { LoopStack.Pop(); break; } } }