--- id: kw-fn name: fn category: structure kind: keyword tokens: fn sig: fn name tip: A top-level function named as a value - the entry point handed to Job.parallel_for. order: 9 --- fn name names a top-level function as a value, so it can be handed to something that calls it later - today, Job.parallel_for, which runs it on worker threads. It is a plain function reference: no closure and nothing captured, so everything the function needs is passed to it (for Job.parallel_for, through its ctx argument). A worker function takes (i: int, ctx) and returns void; the compiler rejects any other shape. ```ludic program Squares { function square(i: int, out: words) -> void { out[i] = i * i } entry { let sq = words(1000) Job.parallel_for(1000, fn square, sq) print(sq[12]) } } ```