print function

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 4 02:05:15 PST 2016


On Thursday, February 04, 2016 00:40:55 ixid via Digitalmars-d-learn wrote:
> On Thursday, 4 February 2016 at 00:30:03 UTC, cym13 wrote:
> > On Thursday, 4 February 2016 at 00:23:07 UTC, ixid wrote:
> >> It would be nice to have a simple writeln that adds spaces
> >> automatically like Python's 'print' in std.stdio, perhaps
> >> called print.
> >
> > Sounds way too redundant to me.
>
> Normally you'd be right but printing out data is such a common
> thing, especially for beginners. It's the kind of thing that can
> make their early experience of a language a lot more positive.
>
> writeln(a, " ", b, " ", c, " ", d);
>
> Is very clunky. Programming languages are like cereal, you need
> sugar to get the kids hooked.

I would normally expect someone to do that with writefln, which would be
cleaner. e.g.

writefln("%s %s %s %s", a, b, c, d);

Personally, I've never felt the need for a function like you're describing.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list