For Next not displayed correctly on 2021 r2

Hi. I’ve recently updated from 2021 r1 to 2021 r2. I’ve noted now, the FOR / NEXT statements in the code are not “closed” (the NEXT is not going in the left at the same position of the FOR), so it’s like a not closed FOR / NEXT.

When compiling and executing the core, all works fine, but it’s impossible to see and work with the code as it starts moving right and all seems to be not closed… at the end you only have a window filled with vertical lines.

Anyone knows how to fix this?.


There are currently some issues like this in 2021r2. I think most of these have been marked fixed. I fix it in my code when I encounter it by removing and re-adding the “Next” line.

Anthony answered it :slight_smile:

I’ve removed the next and write them again and it’s making the same

In that case, Brian’s original suggestion of a screenshot would help. If that didn’t fix it, it may be that the For and Next lines actually don’t match.

A screen of what’s going on

Take a look at my screen capture. In 2021 r1 is displayed correctly and works correctly. In 2021 r2 is working correctly, but it’s not displayed correctly

Wow. That’s a lot of loops using the same variable name. Let me play around here and see if we can find a solution.

What happens if you change:
next i

OK, the problem is the For line. Add a space before and after the = sign on each of those lines.

for i = 0 to someVar.LastIndex
1 Like

it’s working… now it’s displayed correctly, but I need rot indicate what next is been closed, as I’m making lot’s of recursive loops ones inside others, and not always the closest for is the one to close…

You’re right… making this space now it’s displayed correctly.


Happy to help!

Find “i=0” in the method only replace then with “i = 0”

That should be reported as a bug.
And how did that get past testing, anyway ?

I just upgraded to 2021.R2 and it is driving me nuts… I now have a bazillion “errors” in my mainstream app that won’t compile to the point I’m considering going back to 2021.R1 simply to get it to compile, again.

While I can replace every “=” with " = " and then replace all the " = " with " = " it suggests the interpreter is a tad dodgy at parsing the syntax of such a BASIC (pun intended) statement.
(NB sorry double spaces don’t appear as such - there really IS a reason to use a monospaced font like Courier for code)

This particular one has already been reported and the case marked as fixed, IIRC. It probably wasn’t found because the Xojo Engineers (and, apparently, those of us in the Testers group) use whitespace.

They’re trying to put in some very much-needed changes to the editor, so there will be problems. No person or testing framework can account for everything, hard as we may try.

1 Like

If I was still in the testers group I’d probably not have found this either as I always run my reformat code script which puts put all my code in a working state. I can probably guess at why this wasn’t noticed, but if you want something to help you in the short term, take a look at my reformat code script here, just go through the settings before you use it so it doesn’t make any unwanted changes to your code. All you need to do then is move the cursor up/down the code or cut and paste code chunks and it’ll fix things automatically.

However, if you have lots of errors distributed around a large project, it might just be easier for the time being to rollback to a previous version of the ide.

1 Like

Judging by the stupid bugs which end up in releases I don’t think Xojo beta’s get much testing these days. Probably hasn’t been helped by Xojo throwing everybody out of the testers group if they don’t have a current license.

1 Like

This has been fixed in 2021r2.1

1 Like

Yup after 2 hours of struggling with this in a project with ~20MB of source code, I’ve reverted back to 2021.R1. There are other issues that show up with R2 besides “=”.

After 20 years of RB/Xojo I settle on a rev that works well enough, and not upgrade until absolutely compelled to do so. Often several years.

And I long ceased reporting bugs, it never seemed to make any difference to how long it took for Real/Xojo to fix, and mostly the user community are the beta testers (hasn’t really changed in 20 years).

I just wait for bugs to get fixed… eventually. Sometimes I have to find creative workarounds to avoid a known show-stopper, or ditch Xojo for another environment to get the job done, but hey, c’est la vie.

I’d hate to say this but Xojo appaear to be deliberately obfuscating the language with excessive verbiage to the point it really is hideous. I’m happily making classes to wrap all the damn API nonsense back into a simple syntax that is well… bleeding obvious and easy to use.

As I said before… take a look at timers. Something so simple is now a mess of different syntaxes across desktop, web and iOS.