๐ฆญConditionals
case
case {1, 2, 3} do
{1, 2, 5} -> "This will not return"
{4, 5, 6} -> "Neither will this"
{1, x, 3} -> "This will work with any #{x}"
_ -> "This is used as the 'default' case"
endx = 5
case {1, 2, 3} do
{1, 2 ^x} -> "This will also try matching {1, 2, 5} and fail"
_ -> "This will be the result"
endcase {1, 2, 3} do
{1, 2, 5} -> "This will not return"
{4, 5, 6} -> "Neither will this"
{1, x, 3} when x < 3 -> "This will work with any #{x} < 3"
_ -> "This is used as the 'default' case"
endif
cond
unless
Returning conditionals
Last updated