Skip to content

For/Next with Step -x issue when using variable=0 for the TO value #26

@chunkypixel

Description

@chunkypixel

When using a For/Next Loop with the Step -x option (stepping backwards) if you set the To value using a variable and NOT hard-coded then you get a lockup if the variable = 0.

Example

 dim indexPosition = var0
 dim index = var1

 indexPosition = 0  ;FAIL
 ;indexPosition = 1  ;OK
 ;indexPosition = 2  ;OK
 for index = 2 to indexPosition step -1
 next

 ;WORKS
 ;for index = 2 to 0 step -1
 ;next

MainLoop
 BACKGRND = rand
 goto MainLoop

I assume as the indexPosition value is not known at compile time this may be a limitation of the feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions