That'd be about right. 1950s structured programming approaches, which were refined and formalized in the 1960s, being taught in 1995.
There are languages, like COBOL, where the language itself doesn't allow you to violate the one return statement. Fortunately, JavaScript is not COBOL.
Well it's interesting to explore WHY they stressed this.
In the Assembly language world having jumps all over the place was a real problem. In the grand scheme of evolution this was an important principle.
Of course higher level languages made this point moot (in my opinion). And in fact, returning early often saves you from having to deal with flags which are really a horrible programming style.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
That's one of the commandments from the structured programming era of programming. Apparently some professors are still living in that era.
When I had that class would have been around '95
That'd be about right. 1950s structured programming approaches, which were refined and formalized in the 1960s, being taught in 1995.
There are languages, like COBOL, where the language itself doesn't allow you to violate the one return statement. Fortunately, JavaScript is not COBOL.
Well it's interesting to explore WHY they stressed this.
In the Assembly language world having jumps all over the place was a real problem. In the grand scheme of evolution this was an important principle.
Of course higher level languages made this point moot (in my opinion). And in fact, returning early often saves you from having to deal with flags which are really a horrible programming style.