Aquila wrote: > case key.strip > when "c" "Synopsis" > when "s" "Category" > when "io" "Inputs and outputs" > when "processing" "Processing type" > when "d" "Description" > when "n" "Notes" > when "e" "Examples" > when "h" "Element handlers" > when "a" "See also" > else puts "Unknown key" > end > if key.strip == "a" > puts "This gives output" > end > unknown key > This gives output > > What am I doing wrong? I'm a really Ruby newbie so probably I'm looking at > it the wrong way... You forget to put "puts" before you're Strings. This will work: case key.strip when "c" puts "Synopsis" when "s" puts "Category" ... end And this will also work and require less repetition: puts case key.strip when "c": "Synopsis" when "s": "Category" ... end Though I wonder if you're not better of with a Hash: puts({ "c" => "Synopsis", "s" => "Category", ... }[key.strip])