RosettaCodeData/Task/Extend-your-language/R/extend-your-language-1.r
2023-07-01 13:44:08 -04: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)
}