Consider the following function

Untitled Forums Statistics R programming Consider the following function

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15883
    nammy
    Participant

    Consider the following function
    f <- function(x) {

    g <- function(y) {

    y + z

    }

    z <- 4

    x + g(x)

    }
    If I then run in R
    z <- 10

    f(3)
    What value is returned?

    #15884
    nammy
    Participant

    ANSWER: 10

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.