Tutorial by Examples

import std.stdio; bool isPrime(int number) { foreach(i; 2..number) { if (number % i == 0) { return false; } } return true; } void main() { writeln(2.isPrime); writeln(3.isPrime); writeln(4.isPrime); 5.isPrime.writeln; } ...
void main() { import std.algorithm : group; import std.range; [1, 2].chain([3, 4]).retro; // [4, 3, 2, 1] [1, 1, 2, 2, 2].group.dropOne.front; // tuple(2, 3u) }
import core.thread, std.stdio, std.datetime; void some_operation() { // Sleep for two sixtieths (2/60) of a second. Thread.sleep(2.seconds / 60); // Sleep for 100 microseconds. Thread.sleep(100.usecs); } void main() { MonoTime t0 = MonoTime.currTime(); some_opera...

Page 1 of 1