a <- function() {
X <- 1
X <<- X+1
X <<- X+1
return(X)
}
result <- a()
print(result)
print(X)
print(result)の結果、1表示され、
print(X)では2が表示されるってわけ
Go to list of users who liked
More than 5 years have passed since last update.
a <- function() {
X <- 1
X <<- X+1
X <<- X+1
return(X)
}
result <- a()
print(result)
print(X)
print(result)の結果、1表示され、
print(X)では2が表示されるってわけ
Register as a new user and use Qiita more conveniently
Go to list of users who liked