Another Salesforce blog!!!

Salesforce, Apex

August, 2012

Refactoring horrible nested if-else statements

I wrote this at some point this week, I was looking back at it tonight and released how truly awful it looks: if(filePath.Contains(“.CSS”)) return true; else return false; else if(filePath.Contains(“.JS”)) return true; else return false; else if(filePath.Contains(“_STR”)) return true; else return false; else if(filePath.Contains(“.VBS”)) return true; else return false; else if(filePath.Contains(“.HTM”)) return true; else return […]