3 AnswersNew Answer
Comments are pieces of text ignored by the compiler/interpreter. By conventional coding practises, the comment should explain the code following.
Yes. You are right. But comments shouldn't necessarily explain exactly what the code does that should be self explanatory just by looking at it by the logic and good naming convention. But comments should be utilized to explain "Why it's done like that". Some code is self explanatory take this: // Set x variable to Don string x = "Don"; First terrible naming convention. Secondly, it's pretty obvious what it does. We can essentially solve this with good naming conventions. Change x to name.
Yes, completely right. It's basically for the other coder to understand that what actually is going on in that particular code or segment.