Skip to content

Declare counter variable in for statements #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2019
Merged

Declare counter variable in for statements #556

merged 1 commit into from
Mar 21, 2019

Conversation

per1234
Copy link
Collaborator

@per1234 per1234 commented Feb 21, 2019

Declaring the counter variable outside the for statement is done very rarely in actual programming, and only when there is a use for that variable outside the scope of the for loop (which is not the case here). I don't see any value in declaring the variable outside the statement in the example code, as it only teaches bad programming without providing any benefit. In some cases, the example code snippets didn't even contain a declaration and so would not compile if copied into a sketch.

Declaring the counter variable outside the for statement is done very rarely in actual programming, and only when there is a use for that variable outside the scope of the for loop (which is not the case here). I don't see any value in declaring the variable outside the statement in the example code, as it only teaches bad programming. In some cases, the example code snippets didn't even contain a declaration and so would not compile if copied into a sketch.
@robsoncouto robsoncouto merged commit 44db95a into arduino:master Mar 21, 2019
@robsoncouto
Copy link
Contributor

Hi per, I agree with you that this goes against good practice.
Merged, thanks

@per1234 per1234 deleted the declare-counter-variable-in-for branch March 21, 2019 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants