4 ms·
The code is very easy read. And, when you're getting started, being easy to read is very important. Besides, it is still semantically correct. (Also FWIW, I did
by Zev 15y ago
The code is very easy read. And, when you're getting started, being easy to read is very important. Besides, it is still semantically correct. (Also FWIW, I didn't find it very awkward, personally.)
I might even be convinced to go a step further and say that early on, it is far more important to actually get started and avoid hitting roadblocks, then it is to write nice and pretty code. You can figure that out later on, once you're comfortable with everything.
- billjings 15y agoI think his point is that the code is written differently than it would be written in practice solely to make a pedagogical point. Tutorial code should exemplify well-written practical code in addition to whatever concept is being demonstrated. This particular construct is debatable - I personally think it can read better to explicitly break out a boolean statement like that in some cases, especially in a simple method like in this example. I certainly wouldn't take a hostage over that opinion, though.