RosettaCodeData/Task/Conditional-structures/R/conditional-structures-4.r

7 lines
184 B
R

x <- "match"
switch(x, mat = 0, match = 10, other = 100, 1000)
x <- "ma"
switch(x, mat = 0, match = 10, other = 100, 1000)
x <- "foo"
switch(x, mat = 0, match = 10, other = 100, 1000)