Skip to content

Instantly share code, notes, and snippets.

@run-dlang
Created April 12, 2018 10:42
Show Gist options
  • Select an option

  • Save run-dlang/20fff4ebb9a8845f87bbc142110653e0 to your computer and use it in GitHub Desktop.

Select an option

Save run-dlang/20fff4ebb9a8845f87bbc142110653e0 to your computer and use it in GitHub Desktop.
Code shared from run.dlang.io.
void main()
{
import std.stdio: write, writeln, writef, writefln;
int[3] s;
int[3] t;
s = t; // the 3 elements of t are copied into s
s[] = t; // the 3 elements of t are copied into s
s[] = t[]; // the 3 elements of t are copied into s
s[1..2] = t[0..1]; // same as s[1] = t[0]
s[0..2] = t[1..3]; // same as s[0] = t[1], s[1] = t[2]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment