Jump to content

Enforced immutability: Difference between revisions

Add SuperCollider example
m (added a ;Task; (bold) header, added whitespace before the Table of Contents (TOC).)
(Add SuperCollider example)
Line 1,022:
<lang ruby>define PI = 3.14159; # compile-time defined constant
const MSG = "Hello world!"; # run-time defined constant</lang>
 
=={{header|SuperCollider}}==
<lang SuperCollider>a = [1, 2, 3];
a[1] = 100; // returns [1, 100, 3]
a.freeze; // make a immutable
a[1] = 2; // throws an error ("Attempted write to immutable object.")
</lang>
 
=={{header|Tcl}}==
83

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.