Login Page - Create Account

Support Board


Date/Time: Fri, 29 Nov 2024 02:33:20 +0000



Post From: canceled stop order continues to have status SCT_OSC_OPEN

[2023-03-16 15:07:04]
Berliner JFK - Posts: 45
Hello @ondafringe. It took some time to understand what you wrote, and reflect on how it related to my code.

In short, you were right. This was my issue. I was using a non-persistent variable, but it was in scope and therefore retained it's value regardless of how many loops or how long the program ran.

Unless the code returned to that scope (e.g. inside an if-then statement), the variable retained it's value. To me, as a new programmer, it was very difficult to get my head around this concept, but it explains why a non-persistent variable acted like a persistent variable, instead of being "destroyed" after the function returns / loops.

For now, I solved the problem by explicitly resetting the variable to zero, but I suppose I could have also solved it by moving the variable out of scope, i.e. declaring it at the base level of my script, correct?

Either way, thank you. I can finally appreciate everything that you wrote, and it did help me.
Date Time Of Last Edit: 2023-03-16 15:18:28