www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Contract example

Hi guys,

i'm pretty new to D (wrote a simple Hello World), but ... shouldn't the out
assert be more like (x * x) == result?

long square_root(long x)
in
{
assert(x >= 0);
}
out (result)
{
assert((result * result) == x);
}
body
{
return math.sqrt(x);
}
Nov 15 2004