case when else

case expressions
when condition1
  # do something for c1
when condition2
  # do something for c2
else
  # do something else
end
v = "any value"
type = case v
when 'v1' then 'value1'
when 'v2' then 'value2'
else v
end

Reference

results matching ""

    No results matching ""