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;
)