Task

Increment a numerical string.




      num$ = "567"
      REPEAT
        PRINT num$
        PROCinc$(num$)
      UNTIL FALSE
      END
 
      DEF PROCinc$(RETURN n$)
      LOCAL A$, I%
      I% = LEN(n$)
      REPEAT
        A$ = CHR$(ASCMID$(n$,I%) + 1)
        IF A$=":" A$ = "0"
        MID$(n$,I%,1) = A$
        I% -= 1
      UNTIL A$<>"0" OR I%=0
      IF A$="0" n$ = "1" + n$
      ENDPROC