This is (should be) the exact equivalent of the Cilia code in D:
- Types
int,long,float
- Variables
int x = 42;auto x = 42;immutable int x = 42;string[] words;HashSet!string names;ContactInfo[string] contactInfoForID;
- Functions
int multiply(int a, int b) { return a * b; }void print(ContactInfo a) { ... }string concat(string a, string b) { return ...; }
- Loops
foreach (i; 1 .. 11) { ... }foreach (i; 0 .. words.length) { ... }foreach (i; [5, 7, 11, 13]) { ... }foreach (word; words) { ... }
Note
In Dintand42are 32 bits wide, not 64 bits.