Ad
  • Custom User Avatar

    ifelse is a vector operator, so you should probably use:
    break_chocolate <- function (n, m) {
    ifelse(min(m,n)==0, 0, m*n-1)
    }

    and the function will return for every pair of elements from each vector!