Пример #1
0
        //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();
            }
        }
Пример #2
0
 public void Execute()
 {
     if (loop)
     {
         id = LoopStack.Id();
     }
     foreach (var item in block)
     {
         item.Execute();
         if (loop && id < LoopStack.Id())
         {
             LoopStack.Pop();
             break;
         }
     }
 }