home/ atoms/ sc-enclosures-types

SC uses four enclosure types with distinct purposes: parentheses, brackets, braces, and quotes

Parentheses () serve three roles: wrapping argument lists, forcing evaluation order, and delimiting code blocks. Square brackets [] define Arrays (collections of items). Curly braces {} define Functions — reusable blocks that take arguments via the arg keyword and are evaluated only when .value is called. Double quotes create Strings; single quotes or backslash prefix create Symbols. Every opened enclosure must be balanced (closed). The SC IDE highlights mismatched enclosures.

Examples

rrand(0,10) // parentheses for args [1,2,3,4] // array f = {arg a; a*2}; f.value(5) // function “hello” // string, ‘hi’ // symbol

Assessment

What is the difference between {rrand(0,10)}.dup(5) and rrand(0,10).dup(5)? Why does one produce 5 different values and the other 5 copies of the same value?

“There are four types of enclosures:(parentheses),[brackets],{braces}, and"quotation marks".”
corpus · a-gentle-introduction-to-supercollider-ruviaro-archive-org-c · chunk 8