Does this mean the variable var will be declared 10 times during execution of the loop?
The variable is
declared once. Declaring something is a compile-time directive, not an executable statement. Any initializer in the declaration ( var = 3 ) is an executable statement.
A variable declared inside a block { ... } is allocated memory on a push-down/pop-up stack every time the block is entered. The memory is given back every time the stack is exited. Statements in the block starting at the point of declaration can access the variable.
In a
for while or
do statement, the block is entered and exited with every repetition of the loop.
[ November 19, 2004: Message edited by: Mike Gershman ]