private int GetLoopCounter(ExecutionState state)
        {
            var pair = state.GetInScopeVariableAndExprByName("counter");

            Assert.IsInstanceOf <LiteralExpr>(pair.Value);

            var value = pair.Value as LiteralExpr;

            Assert.IsTrue(value.isBigNum);
            return(value.asBigNum.ToIntSafe);
        }