Exemplo n.º 1
0
            public override IValue Execute(ActuatorBase state)
            {
                IValue value     = mCount.Execute(state);
                long   c         = (long)value.AsReal();
                long   i         = 0;
                var    indexName = string.IsNullOrEmpty(IndexName) ? $"<index>" : IndexName;

                state.VariableTable[indexName] = new IntegerValue(i);
                while (i < c)
                {
                    value = mLoopBlock.Execute(state);
                    ++i;
                    c = (long)(mCount.Execute(state).AsReal());
                    if (state.BreakLoop)
                    {
                        state.BreakLoop = false;
                        break;
                    }

                    if (state.BreakProgram)
                    {
                        break;
                    }
                    state.VariableTable[indexName] = new IntegerValue(i);
                    value = mCount.Execute(state);
                    c     = (long)value.AsReal();
                }
                return(value);
            }