waf

FORK: waf with some random patches
git clone https://git.neptards.moe/neptards/waf.git
Log | Files | Refs | README

example.d (896B)


      1 module abc.
      2 def.	gh;
      3 
      4 import std.stdio;       // for writefln()
      5 import std .  // system2;
      6 system  ;
      7 //static import std.date, std.thread /+ /+ +/ , std.io +/ ;
      8 
      9 import testlib.code;
     10 
     11 int main(string[] args)   // string is a type alias for const(char)[]
     12 {
     13 	// Declare an associative array with string keys and
     14 	// arrays of strings as data
     15 	char[][] [char[]] container;
     16 
     17 	int result = test_lib();
     18 
     19 
     20 	// Add some people to the container and let them carry some items
     21 	container["Anya"] ~= cast(char[]) "scarf";
     22 	container["Dimitri"] ~= cast(char[]) "tickets";
     23 	container["Anya"] ~= cast(char[]) "puppy";
     24 
     25 	// Iterate over all the persons in the container
     26 	foreach (const(char)[] person, char[][] items; container)
     27 		display_item_count(cast(char[]) person, items);
     28 	return 0;
     29 }
     30 
     31 void display_item_count(char[] person, char[][] items)
     32 {
     33 	writefln(person, " is carrying ", items.length, " items");
     34 }
     35