- Do one thing.
- Do it well.
- Keep it concise.
- Use only what is given.
Today we continue from Comments and explore how to refactor out code from blocks. In Comments, we learned to extract code out into it’s own method whenever we use a comment to describe a block of code. Today, we are going to look at how to do the same thing with blocks.
A block of code is any code that exists within a if, a loop, or a switch statement.