Values & References2 / 8
Up next

Copy-on-modify

a <- c(1, 2, 3)
# b starts as a copy of a
b <- a
# modifying b does not touch a
b[1] <- 99
print(a)
print(b)
What you're solving

assignment copies when modified