With the subroutine which can generate a forloop with necessary stride for any variable