SuperCollider methods do not auto-return their last expression; the caret (^) designates the return value
Unlike functions, SuperCollider methods do not automatically return the value of their last expression — you must explicitly precede the intended return value with the caret symbol (^). Inside a method body, this refers to the receiver of the message (for 144.tempodur, this is 144). Method definitions live in class-extension files using the + ClassName { methodName { … } } syntax; class methods are prefixed with * (e.g. *new) while instance methods have no prefix. After editing an extension file you must recompile the class library before the method is available. Forgetting the caret makes the method return the receiver itself, not the computed value — a common beginner bug.
Examples
+ SimpleNumber { tempodur { // instance method: no * var tempo = this; // receiver ^(60/tempo); // ^ designates return value } }
Assessment
A student writes a method that computes a result but omits the ^ caret. What does the method return instead? Why does SC not auto-return the last line in methods as it does in functions?