fork download
  1. import std.stdio;
  2.  
  3. void forTest(T)(T[] array)
  4. {
  5. writeln(array.length);
  6. foreach (int i; array)
  7. {
  8. write(i, ' ');
  9. }
  10. writeln();
  11. }
  12.  
  13. void main()
  14. {
  15. writeln("Hello World");
  16.  
  17. int test[] = [3, 4, 5, 6, 7];
  18. forTest(test);
  19.  
  20. test = [3, 5, 4, 3];
  21. forTest(test);
  22.  
  23. test = [3, 2, 5];
  24. forTest(test);
  25.  
  26. test = [3, 2, 5, 7, 8, 8, 9, 9, 10];
  27. forTest(test);
  28.  
  29. test.length = 24;
  30. test = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
  31. forTest(test);
  32. }
Success #stdin #stdout 0.01s 2120KB
stdin
Standard input is empty
stdout
Hello World
5
3 4 5 6 7 
4
3 5 4 3 
3
3 2 5 
9
3 2 5 7 8 8 9 9 10 
20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20