Syntax
Tells whether a task has returned normally. Polled from the main loop, it lets the game keep drawing while the task works.
TaskDone(<handle>)Parts
| <handle> | A task handle: a variable filled by STARTTASK. |
|---|
Returns
True once the task reached its RETURN. False while it runs, and also when it failed or was cancelled.
Good to know
TaskDone()answers true or false, not 1 or 0. Test it bare or withNOT.IF TaskDone(h) = 1is always false.= TRUEworks.- Str(TaskDone(h)) gives
trueorfalse. - A handle that never received a task (still
NULL) stops the program withBASIC value is not a task handle.
Example
job AS TASKHANDLESTARTTASK job, WorkConsole(Str(TaskDone(job))) ' falseAWAITTASK jobConsole(Str(TaskDone(job))) ' trueIF TaskDone(job) THEN Console("done") ' doneENDWork: Wait(0.2)RETURN 1In the manual : The game loop and tasks