1
Completed

While and End While statements

I think Tasker is missing a while loop. I understand that there's the GoTo action, but it does not help with how easy it is to see where it begins and thus making it harder to edit.

3 replies

I

I want a small improvement in the goto command. Instead of a line number (which is fine), but also a relative line number.

goto -3: 3 lines back

goto +5: 5 lines forward.

The reason is because is very annoying when you edit a small piece of code (add or remove lines) outside the goto loop and break the loop because it points to another place.

Note: I don't want to replace the current behaviour. Just add as a new goto type

That's why the label option in the Goto command exists :) That way you can keep the label in the action and always jump to it.

S

I never knew what the label function was for! After all these years, I'm still learning new things about this app!!! Thanks João!!

M

Something like:

while active
...

End while

So far my solution is

If active

....

goTo if

End if

Are you maybe looking for the ForEnd For actions? :)

M

A for loop is not always the best solution, sometimes you just don't know how many times you'll need the loop to run. I know that I can get the same behavior with a combination of if and go-to statements, but it feels unecesarily cumbersome.