Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I have heard opinions that it is best to stick to the standard of the project you work in, so that the new code is written in a similar style, then the code is easier to read. Unfortunately most C/C++ projects are very old, so they are written in different styles, then refactoring the file you are changing looks like a good approach.
Thanks for the quick reply. Makes sense. I overlooked the multiple return statements.
Do you know if there is a best practice in c++ for single vs multiple returns? Or is that more preference or just debated?
I cannot agree with that for the above case.
Since we have a return in each if, the program will not check the next conditions. So using an else if here will have the same effect and it only increases the length of the code and may only be puzzling for the reader of the code why some put else keyword.
Wouldn't it be more efficient to use "else if" statements. This would require all statements to be run, where else if would stop once a match was found.