Reputation: 10925
Google Style Guide says to always use local
variables and put everything into function
.
On the other hand sample for
loop is provided:
for dir in ${dirs_to_cleanup}; do
...
done
Why there is no convention to always declare loop variable as local just before loop? Or maybe the following is the way how loops inside functions should be written to comply with the style guide?
local dir
for dir in ${dirs_to_cleanup}; do
...
done
Upvotes: 1
Views: 252