Skip to content

Instantly share code, notes, and snippets.

@run-dlang
Created January 24, 2019 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save run-dlang/809bd9a1555a66a3ad69d32c12b9a191 to your computer and use it in GitHub Desktop.
Save run-dlang/809bd9a1555a66a3ad69d32c12b9a191 to your computer and use it in GitHub Desktop.
Code shared from run.dlang.io. Run with '-unittest'
void main()
{
import std.algorithm, std.conv, std.stdio;
"Starting program".writeln;
// Sort a constant declaration at Compile-Time
enum a = [ 3, 1, 2, 4, 0 ];
static immutable b = sort(a);
// Print the result _during_ compilation
pragma(msg, text("Finished compilation: ", b));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment