[Tutorial] Beautiful, Readable Code (Indentation, Whitespace, Comments)
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
A few more returns may indeed be an improvement. Sometimes I see people writing a command which has a dozen prerequisite checks forced in equally as many lines. Not good.

Also your coding style may play a role in readability. I and many others use the Allman style, which is the most readable in my opinion, but some people actually do this:

pawn Код:
} else {
Ugh.
You raise an excellent point. I contemplated including a section dedicated to style, but figured because the topic is so opinionated that I would leave that choice up to the reader to research. I provided the examples in Allman, which I also believe is the most readable style. Some would make the case that the slight sacrifice in readability results in more code being viewable on the screen. Personally I can't stand K & R and its variants.

Maybe an in-depth look at different indentation styles for a future thread?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)