While trying to learn parallel programming with julia, I came across the function Task(func) which, according to julia documentation, creates a callable task that executes the function func and can be run later. However, it seems that func doesn't have to be a function; any set of statements will do. For example:
t = Task(begin; sleep(5); println("done"); end)
schedule(t)
which gives the following result upon execution with julia 1.6.2
done
This is confusing. Do the set of statements begin; sleep(5); println("done"); end constitute a function (anonymous). If so, how? Thank you for your help.