Wrapping SuperCollider lines in outer parentheses makes a code block that evaluates as one unit on a single keypress
In SuperCollider, enclosing multiple lines of code in a pair of outer parentheses creates a code block. With the cursor placed anywhere inside, pressing ctrl+Enter (cmd+Enter on Mac) evaluates all the enclosed lines in order, top to bottom. SC briefly highlights the block to confirm exactly what was executed. Code blocks remove the need to manually select every line by hand on each evaluation. They are the standard container for anything that must be evaluated atomically as a unit — multi-line SynthDefs, and multi-Pbind patches whose voices should start together.
Examples
(
"line one".postln;
"line two".postln;
2 + 2;
)
With the cursor inside, one ctrl+Enter runs all three lines in order.
Assessment
Write a two-Pbind patch inside a single code block so both start simultaneously on one ctrl+Enter with the cursor inside. Modify one Pbind’s \dur and re-evaluate — verify both voices restart together.