Learning how to program in the stastics-based language R involves using loops such as for and while, as well as if statements. It’s standard stuff that I assume most programming languages include. Even in graduate school for my maths masters, I took a math-based programming course, sans computer, that focused on creating logical programs using pencil and paper. And discussion of loops was covered in the course. So when today I started a new lesson creating functions, I noticed the lines to the left of each line of code and thought of a rudimentary course in BASIC programming that I took in the time Pre-Internet.
If you’re old enough to remember BASIC, this simple program should be familiar:
20 IF (A<10) GOTO 50
40 GOTO 20
In BASIC, statements and functions direct the computer to a specific line of code to execute. It was an incredibly logical approach to learn a bit of programming: BASIC is in fact an acronym for "Beginner's All-purpose Symbolic Instruction Code."
Noticing those “line numbers” to the left of my code has me wondering if any modern programming languages still use calls to specific line numbers. Because it was used in some languages on mainframes, such as COBOL:
If you look at the second blue PERFORM above, the statement is to goto line 200 if the variable “present value” is not equal to zero.
A few years after I had learned BASIC, I found out that there were now programming languages that didn’t use line numbers. It was a mind-blowing idea for me: how do you know where to goto next? I expect my mind to be further blown when I create programs in R that do just that.