code: public void step(int step, Closure closure) {
          if (step == 0) {
              if (!getFrom().equals(getTo())) {
                  throw new GroovyRuntimeException("Infinite loop detected due to step size of 0");
              } else {
                  return; // from == to and step == 0, nothing to do, so return
              }
          }
  
          if (isReverse()) {
              step = -step;
          }
          if (step > 0) {
              int value = getFrom();
              while (value <= getTo()) {
                  closure.call(Integer.valueOf(value));
                  if((0L + value + step) >= Integer.MAX_VALUE) {
                      break;
                  }
                  value = value + step;
              }
          } else {
              int value = getTo();
              while (value >= getFrom()) {
                  closure.call(Integer.valueOf(value));
                  if((0L + value + step) <= Integer.MIN_VALUE) {
                      break;
                  }
                  value = value + step;
              }
          }
      }
docs: {@inheritDoc}