On Tuesday, 2 November 2021 at 23:02:42 UTC, Ali Çehreli wrote:
On 11/2/21 3:57 PM, Ali Çehreli wrote:

Here is a more idiomatic version:

import std.stdio;
import std.string;

void main() {
  const x = strip(readln());
  writeln(x);

  if (x == "hello world!") {
    writeln("yes");
  }
}

The first line in main can be written with UFCS syntax as well:

  const x = readln.strip;

Ali

This is D point of view to the same classic C code. I think D has the spirit of C++.

Reply via email to