Where statement

Trass3r un at known.com
Sun Jul 25 05:53:02 PDT 2010


> c = sqrt(a*a + b*b) where:
>     a = retrieve_a()
>     b = retrieve_b()
>
> That is equivalent to:
>
> c = (retrieve_a() ** 2 + retrieve_b() ** 2) ** 0.5

You immediately give the counter-argument? ^^
Introducing a new keyword + whole new constructs gotta have substantial  
merit. The 2nd concept is perfect to me, some parentheses are no reason.


Another possibility would probably be the following, but it's not as  
compact and nice:

double c;
{
	double a = retrieve_a();
	double b = retrieve_b();

	c = sqrt(a*a + b*b);
}


More information about the Digitalmars-d mailing list