module pind.samples.ja.const_and_immutable.const_and_immutable_11; import std.stdio; void reverse(dchar[] s) { foreach (i; 0 .. s.length / 2) { immutable temp = s[i]; s[i] = s[$ - 1 - i]; s[$ - 1 - i] = temp; } } void main() { dchar[] salutation = "hello"d.dup; reverse(salutation); writeln(salutation); }