D

2015-01-21 08:19
ufm: (bald-headed)
[personal profile] ufm

Вобще прикольненький такой язык. Со своими тараканами, конечно (ну почему у всех разработчиков языков программирования — столько в голове тараканов?), но прикольненький.


Типа: что выведет на экран эта программа?

import std.stdio;
import std.conv;


void ff(bool a, lazy string s) {
  if (a) {
    writeln(s);
    writeln(s);
    writeln(s);
  }
}


string ss() {
  static int a = 0;
  return "Some ss: " ~ (a++).to!string;
}


void main() {
  ff(true, ss());
  ff(false, ss());
}


Originally published at U.F.M's Homepage. You can comment here or there.

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting