Enforced immutability: Difference between revisions

Content added Content deleted
(Add Swift)
(Added Dyalect programming language)
Line 267: Line 267:
STR1 = 'abc'; // regular constant
STR1 = 'abc'; // regular constant
STR2: string = 'def'; // typed constant</lang>
STR2: string = 'def'; // typed constant</lang>

=={{header|Dyalect}}==

Dyalect supports creation of constants using "const" keyword:

<lang dyalect>const pi = 3.14
const helloWorld = "Hello, world!"</lang>

A constant can contain a value of any type:

<lang dyalect>const sequence = [1,2,3,4,5]</lang>


=={{header|E}}==
=={{header|E}}==