On Monday, 20 December 2021 at 22:02:02 UTC, russhy wrote:
Here how i'd do, but i'm not sure how to keep track of the index of the arguments, i forgot..

```D
import core.stdc.stdio: putc, stdout;

void print(T...)(string prompt, T args)
{
    foreach (a; args)
    {
        alias A = typeof(a);

        static if (is(A : string))
        {
            for (int j = 0; j < a.length; j++)
            {
                putc(a[j], stdout);
            }
        }
        else
        {
            // handle your other types
            print("", A.stringof);
        }
    }

}

void main()
{
    print("Prompt (ignored)", "Hello", " world!\n", 123);
}
```

This will not do for me because I want to do formatted output and I need the index. But thanks a lot for tying to help!

Reply via email to