A problem in converting C code

pascal111 judas.the.messiah.111 at gmail.com
Tue Nov 2 23:27:18 UTC 2021


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++.


More information about the Digitalmars-d-learn mailing list