### Author Topic: For( Loop Slowdown Update  (Read 1089 times)

0 Members and 2 Guests are viewing this topic.

#### meishe91

• Super Ninja
• LV11 Super Veteran (Next: 3000)
• Posts: 2946
• Rating: +115/-11
##### For( Loop Slowdown Update
« on: November 11, 2010, 12:50:19 am »
Most of us know about the For( slow down issues. If you don't, I'll explain it really fast.

Basically if you have a piece of code that does something like this:

Code: [Select]
For(A,1,9If fPart(A/2\Do something.\End
When ever that conditional is false it will cause a slow down for the loop, which is annoying. However there are three ways to fix this. First, you can simply put a parenthesis at the end of the For( loop line (so it'd become For(A,1,9)), second, there is a OS fix by BrandonW that apparently fixes it and, three, you can make the If statement an If:Then statement.

Now to the point of this thread. I know I have been curious about this question for quite a while, as I'm sure a few other people. The question is basically: What about if you have nested For( loops? Do you have to close both of them?

Well to be honest we still don't have a definitive answer to this but the current thinking, by a lot of people is that you only have to close the nested one. So for example:

Code: (Took 44 seconds.) [Select]
For(A,0,94For(B,0,62If not(AB Pxl-On(B,AEndEnd
could become:

Code: (Took 37 seconds.) [Select]
For(A,0,94For(B,0,62)If not(ABPxl-On(B,AEndEnd
I just did a quick test with just this example and it seems to have checked out however this hasn't been concretely proven yet. Just thought I'd let everyone know

Courtesy of DJ:
Quote
In some rare cases, not closing the parhentesis of a for( loop under such circumnstances can cause the calc to slow down by about 1.5 until the ON key is pressed or the program is exited.
« Last Edit: November 11, 2010, 12:59:34 am by meishe91 »
Spoiler For Spoiler:

For the 51st time, that is not my card! (Magic Joke)

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55882
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: For( Loop Slowdown Update
« Reply #1 on: November 11, 2010, 12:56:21 am »
Interesting. Could you add that in some rare cases, not closing the parhentesis of a for( loop under such circumnstances can cause the calc to slow down by about 1.5 until the ON key is pressed or the program is exited? I had that happen while coding Illusiat 13, but I don't know how I triggered that.

BrandonW released a patch fixing those For loop issues, but it's good to keep that trick in mind since most people don't have his patch installed.

#### meishe91

• Super Ninja
• LV11 Super Veteran (Next: 3000)
• Posts: 2946
• Rating: +115/-11
##### Re: For( Loop Slowdown Update
« Reply #2 on: November 11, 2010, 01:00:17 am »
I don't know a whole lot about that rare situation you've encountered so I just copied and pasted what you had said Thanks.
Spoiler For Spoiler:

For the 51st time, that is not my card! (Magic Joke)