April 2017
Beginner to intermediate
394 pages
9h 16m
English
As we said before, how you use white space will determine how readable your code is. Using indentation for code blocks is one way to show the logical structure of a program. Another good way to show this is by using blank lines. Just as a good piece of writing is separated into paragraphs, a good piece of code should be separated into some form of logical grouping. Group statements together that logically go together. Put blank lines between the groups to improve the readability:
//Save position and scale to variables for readability. const float HALF = .5f; M5Vec2 halfScale = m_pObj->scale * HALF; M5Vec2 pos = m_pObj->pos; //Get world extents M5Vec2 botLeft; M5Vec2 topRight; M5Gfx::GetWorldBotLeft(botLeft); M5Gfx::GetWorldTopRight(topRight); ...
Read now
Unlock full access