R is quite different from most other programming languages. One common feature of other languages is the
exit routine, or something with a similar name. In R, that function is
stop, and takes an error message string as an argument. For example:
stop("I don't work on weekends")
Error: I don't work on weekends
and exit the program.