Effect of altering a FOR loop counter inside the loop?

I’m trying to convert this bit of C code (slightly simplified)

unsigned int j;
for (j = 0; j < input_length, j++) {
     if input(j) == DELIMITER {
        j += BASE

The code then relies on the j indexed loop skipping the iterations where j is less than its new value.

How would I code this in Xojo?

Exactly the same way.

Try this:

For j As integer = 0 To input_length

  If input(j) = DELIMITER Then

    j = j + BASE

  End if

1 Like


For j As integer = 0 To input_length - 1
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.