3 added 4 characters in body
source | link

I like to use an analogy from Finding NemoFinding Nemo. I tell them their programming language has the same problem Dory has - short term-term memory loss. When a variable is declared within a block, Java will forget about the variable (just like Dory) after reaching the end of the the block. So a block declares the "scope" of Dory's short term memory.

I've been concerned that students would think that the variables assigned in a block would lose their value after the block has ended, but I've never ranrun into that problem for some reason.

What's interesting about your example is that it won't even compile without the print statement! Java doesn't allow you to have a single declaration statement in an if or loop.

I like to use an analogy from Finding Nemo. I tell them their programming language has the same problem Dory has - short term memory loss. When a variable is declared within a block, Java will forget about the variable (just like Dory) after reaching the end of the the block. So a block declares the "scope" of Dory's short term memory.

I've been concerned that students would think that the variables assigned in a block would lose their value after the block has ended, but I've never ran into that problem for some reason.

What's interesting about your example is that it won't even compile without the print statement! Java doesn't allow you to have a single declaration statement in an if or loop.

I like to use an analogy from Finding Nemo. I tell them their programming language has the same problem Dory has - short-term memory loss. When a variable is declared within a block, Java will forget about the variable (just like Dory) after reaching the end of the the block. So a block declares the "scope" of Dory's short term memory.

I've been concerned that students would think that the variables assigned in a block would lose their value after the block has ended, but I've never run into that problem for some reason.

What's interesting about your example is that it won't even compile without the print statement! Java doesn't allow you to have a single declaration statement in an if or loop.

2 spelling (well wrong words)
source | link

I like to use an analogy from Finding Nemo. I tell them their programming language has the same problem Dory has - short term memory loss. When a languagevariable is declared within a block, Java will forget about the variable (just like Dory) after reaching the end of the the block. So a block declares the "scope" of Dory's short term memory.

I've been concerned that students would think that that the variables assigned in a block would lose thattheir value after the block has ended, but I've never ran into that problem for some reason.

What's interesting about your example is that it won't even compile without the print statement! Java doesn't allow you to have a single declaration statement in an if or loop.

I like to use an analogy from Finding Nemo. I tell them their programming language has the same problem Dory has - short term memory loss. When a language is declared within a block, Java will forget about the variable (just like Dory) after reaching the end of the the block. So a block declares the "scope" of Dory's short term memory.

I've been concerned that students would think that that variables assigned in a block would lose that value after the block has ended, but I've never ran into that problem for some reason.

What's interesting about your example is that it won't even compile without the print statement! Java doesn't allow you to have a single declaration statement in an if or loop.

I like to use an analogy from Finding Nemo. I tell them their programming language has the same problem Dory has - short term memory loss. When a variable is declared within a block, Java will forget about the variable (just like Dory) after reaching the end of the the block. So a block declares the "scope" of Dory's short term memory.

I've been concerned that students would think that the variables assigned in a block would lose their value after the block has ended, but I've never ran into that problem for some reason.

What's interesting about your example is that it won't even compile without the print statement! Java doesn't allow you to have a single declaration statement in an if or loop.

1
source | link

I like to use an analogy from Finding Nemo. I tell them their programming language has the same problem Dory has - short term memory loss. When a language is declared within a block, Java will forget about the variable (just like Dory) after reaching the end of the the block. So a block declares the "scope" of Dory's short term memory.

I've been concerned that students would think that that variables assigned in a block would lose that value after the block has ended, but I've never ran into that problem for some reason.

What's interesting about your example is that it won't even compile without the print statement! Java doesn't allow you to have a single declaration statement in an if or loop.