Delegate

Fabian Claßen admin at fabs-world.de
Tue Dec 2 10:30:47 PST 2008


Hi
I have a problem:

What's wrong about this code?
Code:

import std.stdio;

int main() {
	writefln("%f", add(100, 786, 56.0));
	return 0;
}

double add(double delegate()[] dgs...) {
	double result = 0;
	foreach(double delegate() dg; dgs) {
		result += dg;
	}
	return result;
}

Or a better question is: How can I get the value out of the delegate?

Greetings Fabian Claßen

PS: I am a beginner :P
-------------- next part --------------
A non-text attachment was scrubbed...
Name: admin.vcf
Type: text/x-vcard
Size: 190 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20081202/04714a73/attachment.vcf>


More information about the Digitalmars-d mailing list