I have created a function and in that I have created a variable z.

Next, I have assigned a value of z inside the function and a value outside the function. I was hoping that the value of z which is outside the function will influence the value of variable z but I am getting opposite result

```
f <- function(x) {
g <- function(y) {
y + z
}
z <- 4
x + g(x)
}
z<-10
f(3)
```

and I am getting 10 when I ran in R but I was thinking that answer would be 16