Syntax
Gives the value that a finished task returned with RETURN.
TaskResult(<handle>)Parts
| <handle> | A task handle: a variable filled by STARTTASK. |
|---|
Returns
The RETURN value of the task. If the task failed, it raises the task's error. If the task is still running or was cancelled, it raises BASIC task has no completed result.
Good to know
- Read it after
AWAITTASK, or onceTaskDone()is true. - A task that ends with a bare
RETURNhas no usable result: Str(TaskResult(h)) givesundefined. - This is the way to get a task's value:
x = AWAITTASK his not supported.
Example
job AS TASKHANDLESTARTTASK job, RollAWAITTASK jobscore = TaskResult(job) * 10Console("score " + Str(score)) ' score 60ENDRoll: Wait(0.1)RETURN 6In the manual : The game loop and tasks