From: Ryan Davis Date: 2009-12-14T08:18:48+09:00 Subject: Re: case with && not working compared to using if, works! On Dec 13, 2009, at 12:22 , Derek Smith wrote: > hasval = pidhash.value?(7) ### store true/false > case hasval > when true > then > puts("Running PID == PID in File > ".+(d.to_s).+(t.hour.to_s).+(t.min.to_s)) > when (false && File.size(PIDF) == 1) > then > puts "2nd. PID not active yet file exists", PIDF > when (false && File.size(PIDF) == 0) > then > puts "3rd" > else > puts "no con met" > exit > end It just doesn't work this way. It is nonsensical. Stick to your if/elsif/else and things will work fine. About the nonsensical: case x when a when b ... is roughly equivalent to: if a === x elsif b === x ... So what does this mean? case hasval when (false && File.size(PIDF) == 1) it roughly translates to: if (false && File.size(PIDF) == 1) === hasval or by logical deduction: if false === hasval Which I doubt you meant. Again, stick to simple if/elsif/else statements and you'll be happier. Also, your code drives me bonkers. Check it: puts("Running PID == PID in File ". +(d.to_s). +(t.hour.to_s). +(t.min.to_s)) is about as pedantically awkward as you can get. Dot notation for the + operator?? NO! At worst it should be: puts "Running PID == PID in File " + d.to_s + t.hour.to_s + t.min.to_s Hey look! My space bar works! Also, My pinkies aren't so tired by typing so many parens! Even better, use interpolation: puts "Running PID == PID in File #{d}#{t.hour}#{t.min}" (tho that looks like it'll print out ugly, it is equivalent to your original code and is much more readable.)