Hi, I'm trying to learn some C# over the weekend and am following the 15 exercises found here: http://www.jobsnake.com/seek/articles/index.cgi?openarticle&8533
Yesterday I asked a similar question for the Fibonacci sequence and received some great responses which introduced me to elements of C# which I'd not encountered before: http://stackoverflow.com/questions/406446/refactoring-fibonacci-algorithm
Today I would like to see how a C# Jedi would refactor the following code:
static string Reynolds(int d, int v, int rho, int mu)
{
int number = (d*v*rho) / mu;
if (number < 2100) return "Laminar Flow";
else if (number < 2100 && number < 4000) return "Transient Flow";
else return "Turbulent Flow";
}
So more simple than yesterday, but is there any nice way to deal with the multiple conditionals?
Regards,
Chris