3 ms·
Yes, that is what i meant with "inline variables". IMO this is usually a sign of code that is too long to be readable and if you really need that you should eit
by Crinus 8y ago
Yes, that is what i meant with "inline variables". IMO this is usually a sign of code that is too long to be readable and if you really need that you should either split the function to make it more readable or, if that cannot be done, enclose the affected code in their own brackets (with a comment that makes it easy to distinguish). Brackets also make sure that the variable wont "outlive" its context (although again that is a sign of code that is too long).
Of course that is my opinion (and i'm generalizing of course), but that comes from my experience with working with others' code.
- waruqi 8y agoEven if the function code is very short, I still like to define and declare variables nearby. Unless a function has only two lines of code.
- Crinus 8y agoRight, that is your style, but i wouldn't call that "too many grammar restrictions" :-).
- WoodenChair 8y agoIt's too many grammar restrictions for this person. That's obviously what's implied by the person's original comment.