munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.75k stars 1.03k forks source link

Add an explanation of "else if"? #998

Open jcgoble3 opened 3 years ago

jcgoble3 commented 3 years ago

While working through this book last spring, I glossed over the fact that nowhere in either the Java or C chapters on control flow/jumping does the book explain how if-else if-else statements work. Both chapters just explain if, tack on else, and move on to and and or. It was just tonight that it dawned on me that else if is literally just an if-else whose else block happens to be another if statement.

I realize the printed version is already out, but can we put a blurb in the online book about this magic? Future readers would appreciate it.