Can't understand the application of delegates in toString() functions

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 7 08:33:30 PST 2016


On Monday, 7 November 2016 at 16:22:17 UTC, Heisenberg wrote:
> Why? How can a delegate which returns nothing be used as an 
> array which is going to be printed on the screen?

You pass the string to the delegate, which does whatever with it 
somewhere else.

So you call: `passed_delegate("your string");` and it can forward 
it to writeln or whatever.


More information about the Digitalmars-d-learn mailing list