Question about Tasks and GlobalVars

Why does this start and stop the Task instantly (If updating ~time to 0.01, it stops the Routine, then plays it again with ~time = 0.01 instantly)?

(
// First, stop the current running task
~taskTest.stop;
// Then, update the time value to 0.01 seconds
~time = 10;
// Finally, start a new task with the updated time value
~taskTest = Task({
    inf.do {
        '1'.postln;
        ~time.wait;
    }
}).play;
)

But this waits for the .wait time to elapse before restarting the Task (Run the Task first, then stop it using GlobalVar, update time to 0.01 seconds, but before it plays again, 10 seconds elapses)?

(
// First, stop the current running task
~taskTest.stop;
// Then, update the time value to 0.01 seconds
~time = 10;
// Finally, start a new task with the updated time value
~taskTest.play;
)

// Run this first
(
~taskTest = Task({
    inf.do {
        '1'.postln;
        ~time.wait;
    }
}).play;
)

As explained here, you do not want to do what you’re trying to do here.

If SC allowed you to do this, then you would have the same task scheduled multiple times, and the timing would be destroyed. You do not want to do this.

See the linked post for a solution.

hjh