|
Re: C++ Toggle Button
Very nice answer. And to bring out a couple more subtle points displayed in the answer that will help understandability.
- Don't be afraid to use a bit more whitespace. Parentheses, brackets, and keywords all deserve attention and the whitespace gives the user visual focus. The answer example has a good balance of spacing.
- The code for managing the toggling is now grouped very tight and easily understood without paging around the drive code packed into it. This can be maintained by either putting the drive code into their own sub-functions, or simply making a new section immediately after the toggling code which re-checks the arcade/tank enum solely for the purpose of doing just the drive functions. There is no penalty for re-checking a value such as this.
|