How do you guys write comments on some simple code that you use just for yourself?
I mostly write JavaScript and PHP code, and I can’t really feel like I found a nice way to write comments.
If I have a short line of code, I usually do this:
x = doThis(getSomeValueFromSomewhere()); // This is a short line of code
Which seems really nice I think, but it doesnt really works when the line gets a little longer or on multiple lines,
// Dont really like this since it's not clear if it describes only line 1, or all lines.
aLongerVariableName = (getSomeValueFromSomewhere() == "this is what I want") ? "true value" : "false value";
x = doThis(aLongerVariableName);
So, how do you do it?
maybe reformatted as
And the // for short inline comments like you do.
Don’t forget that Ctrl-/ is your friend 😉