Regarding "If this...and if that..."
"If this...and if that..." answers, this is a clear symptom that the question Needs More Focus, Needs Clarification, or Needs Debugging Details. When questions do not declare a programming language or environment, say for a regex question, then I support the closing of the question because anyone who knows that they are seeking a regex solution will know what language/environment that they will be implementing it in.
This may have been welcome when Stack Overflow was still in its infancy and simply collecting content was critical. Now however, Stack Overflow does not suffer from a deficit of content. It is important to identify the current phase of Stack Overflow's trajectory as the "consolidation & refinement" phase. We need subject matter experts to curate better content by voting, editing, closing, and deleting instead of mindlessly posting on suboptimal and redundant pages.
Regarding answers that resolve the question in a different programming language from what is tagged/described, this is flatly wrong for the page (even if it is correct for the foreign language) and I would downvote this with very, very few exceptions. If I go to my bank in Australia and ask for $100 and they give me $100 New Zealand dollars, that is useless to me -- the same logic applies on Stack Exchange sites. To prevent scope creep, we must discourage language-divergent answers.
For language-agnostic questions which are sufficiently narrow in their scope (e.g. questions with an academic/theoretical tilt), it is important that answers do not provide language-specific solutions. I have seen pages where there is no declaration of a preferred programming language, then the first answer offers a language-specific resolution, then subsequent answers follow the lead of the first and suddenly the page gets railroaded into being language specific.
Perhaps controversially, while I think we need to respect requirements like "using plain JavaScript; no jQuery please", it works against Stack Overflow design to respect questions that limit language-specific resolutions to a maximum language version. Stack Overflow better serves researchers when its content is timeless and the answers do not become stale/obsolete. Outside of SO, such as with Joomla, Ask Ubuntu, etc., there are whole tag pools which are known to be obsolete and therefore become deadwood for the community. We can keep old pages current and helpful by ignoring version requirements. The asker can of course state their current version and accept the answer that accommodates their version.
Ultimately, I think we need to change the broader contribution philosophy from #SOHereToHelp to #HereToHelpSO. We should all ask ourselves if our contributions are moving Stack Overflow toward or away from a better researcher experience.