RosettaCodeData/Task/Extend-your-language/R/extend-your-language-1.r
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

8 lines
231 B
R

if2 <- function(condition1, condition2, both_true, first_true, second_true, both_false)
{
expr <- if(condition1)
{
if(condition2) both_true else first_true
} else if(condition2) second_true else both_false
eval(expr)
}