| « The Ralph Code | Effective Immediately » |
When I'm creating a function, I try to make sure it passes two simple tests:
That said, this code that Paul G. sent in doesn't meet my criteria.
public string StringConcat(string param0, string param1, string param2)
{
return param0 + param1 + param2;
}
public string StringConcat(string param0, string param1,
string param2, string param3, string param4, string param5)
{
return param0 + param1 + param2 + param4 + param5;
}
Actually, come to think of it, that second function is OK, because presumably a rule in their organization is to ignore every fourth string. Also, it is cute that the author of this code was so close to discovering the params keyword...
Re: Where'd param3 Go?
2008-10-29 08:15
•
by
Todd
(unregistered)
|
I'm not sure I'd call a concat method that ignores one of its parameters "functional". |
|
public string StringConcat(string param0, string param1,
string param2, string param3, string param4, string param5) { return StringConcat(StringConcat(param0, param1, param2), param4, param5); } Optimized! |
Re: Where'd param3 Go?
2008-10-29 12:37
•
by
Inno
(unregistered)
|
|
Comments anyone?
if (number % 2 == 0){ // is number even?
.... or just be wicked: if (number % 2 == 0){ // same as: if (number & 1 == 0)
|
| « The Ralph Code | Effective Immediately » |