Structure member cannot be used as FOR variable

From Liberty BASIC Family
Jump to navigation Jump to search


Description

One would expect to be able to use a structure member as the control variable of a FOR...NEXT loop, but it doesn't work. The loop executes the expected number of times, but the value of the structure member does not change. No error or warning is generated.

Example code to demonstrate the bug.

    struct test, v as long
    for test.v.struct = 1 to 10
      print test.v.struct
    next test.v.struct

Example code to work around the bug.

    struct test, v as long
    for tmp = 1 to 10
      test.v.struct = tmp
      print test.v.struct
    next tmp