Xinok:
auto one(int i)
{
if(i > 0)
return cast(int)i;
else
return cast(float)i;
}
With recent D2 compilers I suggest you to get used to write code like that like this:
auto one(int i)
{
if(i > 0)
return int(i);
else
return float(i);
}
It's better to minimize the usage of cast().
Bye,
bearophile
