Modify example to assign task to variable