+ 1
i want to make my code as neat as possible. This C++ teaches you. if (A<B) { cout << "Correct"; } can i actually do, if (A<B) { cout << "Correct"; } where my { put at below shouldent it be like this? and neater? Sorry for bad english.
About If Statement
2 Antworten
0
yes
0
I think that:
if (A<B) {
// Some code with indent at the begining
}
looks nicer... but this is my personal oppinion. And as far as I know, there is no universal code styling standard... even that there are some recommendations around... and an independent programming project can implement their own "code styling standard" that you should use if you want to get involved.
Some general recommendations that I could suggest:
1.- Define a code styling at the beginning of your project and stick to it until the end. There is some beauty in conssistency ;-)
2.- Always indent your code but be aware of overuse of indented groups and consider breaking longer lines.
3.- Keep your classes in several well named files and use headers to avoid having one very long single file.
4.- Create and use name spaces to avoid long function and properties call.
5.- Always comment your code in a clever way, using multiple line comments at the beggining of your classes and functions and single line comments where they are needed.
Those are just my personal view... anyone can have another very good perception... remember always that the beauty is in the eye of the watcher... (I hope that I translate that last one correctly)...
Hope it helped.