else (2,031)


language agnostic How do you handle huge if-conditions?

language agnostic How do you handle huge if-conditions?

It's something that's bugged me in every language I've used, I have an if statement but the conditional part has so many checks that I have to split it over multiple lines, use a nested if statement o…


Insert Update stored proc on SQL Server

I've written a stored proc that will do an update if a record exists, otherwise it will do an insert. It looks something like this: update myTable set [email protected], [email protected] where [email protected] if @@rowcount…


language agnostic Should a function have only one return statement?

Are there good reasons why it's a better practice to have only one return statement in a function? Or is it okay to return from a function as soon as it is logically correct to do so, meaning there m…


bash Boolean Expressions in Shell Scripts

What's the "right" way to do the following as a boolean expression? for i in `ls $1/resources`; do if[$i != "database.db"]then if[$i != "tiles"]then if[$…


xslt Match conditionally upon current node value

Given the following XML:<current><login_name>jd</login_name></current><people><person><first>John</first><last>Doe</last><login_name>jd</login_name></preson><person>…


How do I perform an IF…THEN in an SQL SELECT?

How do I perform an IF...THEN in an SQL SELECT statement? For example: SELECT IF(Obsolete='N' OR InStock='Y' ? 1:0) AS Saleable,*FROM Product…


How can you get Perl to stop when referencing an undef value?

How do you get Perl to stop and give a stack trace when you reference an undef value, rather than merely warning? It seems that use strict; isn't sufficient for this purpose.…


xml How do you switch on a string in XQuery?

I have an external variable coming in as a string and I would like to do a switch/case on it. How do I do that in xquery?…


c Formatting of if Statements

This isn't a holy war, this isn't a question of "which is better". What are the pros of using the following format for single statement if blocks. if(x) print "x is true"; if(x) print "x is tr…



c++ Advantage of switch over if-else statement

What's the best practice for using a switch statement vs using an if statement for 30 unsigned enumerations where about 10 have an expected action(that presently is the same action). Performance and…




statement multiple not conditions conditional example how java nested condition