RubySyntax
Case / When
Code example
case n
when 1 then "one"
else "other"
endMatches a value against cases.
In Ruby, case / when: matches a value against cases — case n when 1 then "one" else "other" end
case n
when 1 then "one"
else "other"
endcase n
when 1 then "one"
else "other"
endMatches a value against cases.
Use case n when 1 then "one" else "other" end.
Use this pattern: case n when 1 then "one" else "other" end
Yes. Use Copy code and adapt the example to your program.
No. The language syntax is the same across operating systems.