When you write a function that uses global variables, ensure that each variable has an appropriate value when the function exits. If another function uses the same variable later, and the variable has an unexpected value on entry to the function, an error could occur.
During debugging, to check that a variable has a reasonable value on entry to a function, set a breakpoint on the line that calls the function and click Silk Test Classic menu to check the value of the variable.
in the