DIP 1027---String Interpolation---Format Assessment

Juraj Mojzis mojo at frikulin.sk
Wed Feb 26 10:35:42 UTC 2020


On Wednesday, 26 February 2020 at 10:02:15 UTC, Juraj Mojzis 
wrote:
> On Wednesday, 26 February 2020 at 09:45:55 UTC, Walter Bright 
> wrote:
>
> void print_many(string msg, int cnt = 1) {
>     foreach(i; 0 .. cnt) writeln(msg);
> }
>
> int apple_cnt = 4;
> print_many(i"I have $apple_cnt apples.");
>
> expected: I have 4 apples.
> real (unwanted) output:
> I have 4 apples.
> I have 4 apples.
> I have 4 apples.
> I have 4 apples.

Sorry, I made a mistake in my last reply.
This is the (unwanted) output:

I have %s apples.
I have %s apples.
I have %s apples.
I have %s apples.


More information about the Digitalmars-d-announce mailing list