Comments
In this page:
Comments
A # starts a comment in R, and everything after it on that line is ignored by the interpreter. R has no multi-line comment syntax, so every comment line needs its own #. Comments should clarify why code does something non-obvious rather than restate what's already clear from the code.
Note: RStudio and most editors let you comment/uncomment a whole selected block at once, adding # to every line.
Example: Comments
# This script demonstrates comments
x <- 10 # inline comment after code
# print(x) -- this line is commented out and won't run
print(x)
Login to try C/C++/Java/PHP code in the editor
🔒
Chapter Quiz — Complete all 6 topics to unlock
0/6 topics done
Complete these topics first: