fork download
  1. import std.stdio;
  2.  
  3. void foo(string x) { foreach (i, ch; x) writefln("x[%d] == '%c'", i, ch); }
  4.  
  5. void main()
  6. {
  7. foo("hello world");
  8. }
Success #stdin #stdout 0.01s 2120KB
stdin
Standard input is empty
stdout
x[0] == 'h'
x[1] == 'e'
x[2] == 'l'
x[3] == 'l'
x[4] == 'o'
x[5] == ' '
x[6] == 'w'
x[7] == 'o'
x[8] == 'r'
x[9] == 'l'
x[10] == 'd'