cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

For loop: set first / last executed entry

☐ cool new feature
☑ could help many users!

☐ removes a „bug“

☐ nice to have

☐ nobody needs it

 

What inspired this wish list request? 

During script debugging, I often want to look into a for loop and execute the code step by step for one of the items.

Most interesting: start the loop with the last value [e.g. after a failure]

 

 

All parameters are already set by the last run, just the looping parameter is missing. This is why most of my for loops look like this:

 

For Each( {mydt}, openTables,
  // mydt = openTables[13]

the disabled code can be executed to set the looping parameter for debugging.

 

 

What is the improvement you would like to see? 

Please add a command to the right click context menu:

hogi_0-1707555632830.png

 

[edit] plan B: Just copy the behavior of the for() loop:
make the looping parameter accessible from outside the loop.
-> if the code stops, the looping parameter is the last one in the cycle.
-> great for debugging

 

Why is this idea important? 

It's not important, but every *) JSL coder will love you.

 

more wishes by  hogi_2-1702196401638.png

 

*) maybe there was a reason to change the behavior.
So: maybe not every  JSL coder is happy to see the old (deprecated?) behavior.

3 Comments
hogi
Level XII

half a year and just 2 Kudos.
@Sarah-Sylvestre , could you please archive this wish : )

hogi
Level XII

@Sarah-Sylvestre 
low prio -> can be closed and reactivated once the important ones are finished.

hogi
Level XII

@hogi wrote:

just the looping parameter is missing.


Ah, now I got it!
It's a disadvantage of the For each loop!

Python:

fruits = ["apple", "banana", "cherry"]
for x in fruits:
  print(x)
print("__")  
print(x)

-> works

 

JSL # 1: for() loop:

Names default to here(1);

for(i=1,i<3,i++, 1);
Print(i);

-> works

 

JSL #2: for each() loop

Names default to here(1);

for each({j}, 1::10,Print(j));
Print(j);

-> fails : j is not defined outside of the for each() loop 
-> makes it difficult to debug the code