FOR NEXT STEP expression

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Jose.

@Fred
Most languages allow you to use an expression in the STEP part of a FOR-NEXT loop.

This code shows the problem;

Code: Select all

#MYSTEP = 20
nMax.l = 20

For n = 0 To 100 Step #MYSTEP ;this works
  Debug n
Next

;------------THIS FAILS AT COMPILE --------------
For n = 0 To 100 Step nMax
  Debug n
Next
;------------THIS FAILS AT COMPILE --------------

; In the help it says
;
;   For  =  To  [Step ]
;     ...
;   Next []

;Note, that this also works
For n = 0 To 100 Step 20 ;this works
  Debug n
Next
so my request, Fred can we PLEASE have support for
;For = To [Step ]

Many Thanks