case-statement

Matching BIT to DATETIME in CASE statement

I'm attempting to create a T-SQL case statement to filter a query based on whether a field is NULL or if it contains a value. It would be simple if you could assign NULL or NOT NULL as the result of a case but that doesn't appear possible. Here's the psuedocode: WHERE DateColumn = CASE @BitInput WHEN 0 THEN (all null dates) WHEN ...

Java: case-statment or if-statement efficiency perspective.

Possible Duplicates: is else if faster than switch() case ? What is the relative performance difference of if/else versus switch statement in Java? I know that case statements can be implemented with jump tables. Does this make them more efficient than if statements? Is this just mico-optimization that should be avoided?...

Pattern matching variables in a case statement in Haskell

If I compare a string literal to a string literal using the case statement, I get the expected behavior: if they are the same - it matches, if they are not - it does not. However, if I compare a string literal to a constant that is a string, I get "Pattern matches are overlapped" warning and the branch with the constant always matches. ...

How to reference a val in a case statement?

I'm having a slow morning. I thought referencing an existing val in a case statement would be OK. But it seems it is interpreted as a local variable definition. A rudimentary googling didn't help and I don't have my staircase book with me. In the following, what is the syntax that would allow me to match on case (b,c)? scala> val (a,b,...

Why am I getting this warning from GHCi?

I'm getting a curious warning when pattern matching, but only when OverloadedStrings is enabled... $ ghci -Wall GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> let f x = case...

Ruby class types and case statements

What is the difference between case item.class when MyClass # do something here when Array # do something different here when String # do a third thing end and case item.class when MyClass.class # do something here when Array.class # do something different here when String.class # do a third thing end For some reason, ...