Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Added duration variable to Blink.ino#10648
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
harryboo commentedSep 9, 2020
Please declare the variable outside of the function 'loop'. |
JeffB42 commentedSep 11, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This is a coding style preference, and I'd prefer to keep it as it is. Is there a style guide that's been published by the Arduino team? That's not meant to be a snarky response, or defensive - I just would genuinely like to know if there is a style guide that's been published by the Arduino team, and if there is, if it states that variables be declared globally and at the top of the file. This is a coding style preference, and I prefer this convention for the following reasons:
I've worked at several companies in my career, and all companies (or at least the recent ones that I remember) used this coding style. I did some googling, and found these discussions: In Java, should variables be declared at the top of a function, or as they're needed? Declaring variables inside or outside of a loop Why declare variables close to where they are used? |
per1234 commentedSep 26, 2020
Moved toarduino/arduino-examples#20 |
Uh oh!
There was an error while loading.Please reload this page.
All Submissions:
Changes to Core Features:
Added duration variable to the Blink.ino sketch. This change has the following benefits: