Original in Russian: http://programmingmindstream.blogspot.ru/2016/03/1195-forto.html
http://blog.marcocantu.com/blog/2016-february-stepping-values-for-loop.html
https://bitbucket.org/lulinalex/mindstream/commits/54a55b7cdfd83633727028150df2b5d8412ac44c
https://bitbucket.org/lulinalex/mindstream/commits/54a55b7cdfd83633727028150df2b5d8412ac44c
Test ForToTest ARRAY operator to ^@ IN aFrom ^ IN aTo @ ( OBJECT IN aLambda INTEGER VAR I I := ( aFrom DO ) Dec I ( aTo DO I ) - LOOP ( Inc I I aLambda DO ) ) FunctorToIterator >>> Result ; // 1to for ( 1 to 10 ) . // - prints numbers from 1 to 10 '' . for ( 1 to 20 ) . // - prints numbers from 1 to 20 '' . for ( 0 to 20 ) . // - prints numbers from 0 to 20 '' . for ( -1 to 20 ) . // - prints numbers from -1 to 20 '' . for ( -1 to 21 ) . // - prints numbers from -1 to 21 '' . 0 for ( 1 to 10 ) + . // - adds up numbers from 1 to 10 and prints the result '' . for ( 1 to 10 Reverted ) . // - prints numbers from 10 to 1 /*{ ARRAY VAR L 1to 10 >>> L @ . L ITERATE // - prints numbers from 1 to 10 '' . @ . 1to 20 ITERATE // - prints numbers from 1 to 20 '' . 0 @ + L ITERATE . // - adds up numbers from 1 to 10 and prints the result '' . @ . L Reverted ITERATE // - prints numbers from 10 to 1}*/ ; // ForToTest ForToTestSure, it is not difficult to add step by writing I := I + Step in Inc I.
As for me, I managed to do it “more concisely” than gurus do.