counter <- 0 bump <- function() { # <<- assigns in the enclosing (here global) scope counter <<- counter + 1 } bump() bump() print(counter)
assign in an enclosing scope