by mncaudill · 16y ago · 0 comments
Let's say you are skimming your code. Are you going to quickly and easily see the difference between "elseif" and "else if"?
Creating a new word, while superficially unwieldly, keeps you from wasting valuable time debugging one of those "d'oh!" bugs.
Now, in Ruby, if you type "elseif" your code will not run. Problem avoided.
The point of Ruby's "elsif" and Python's "elif" is to have visually disparate representations of the two kinds of code blocks (that have different control flows!) that a developer could easily overlook.
The difference is there to help out you and every other developer that use languages that don't use a visible token to separate code blocks, I promise.
can you give an example where this would make a difference?