Welcome to the Treehouse Community
Looking to learn something new?
Ryan Schmelter9,710 Points
Can i create a variable, but not store anything in it until later in the program?
As an experiment, I wrote:
without the value False at the top of the program and followed the rest of the steps in the video. The code still works. I'm wondering if this is acceptable practice to create a blank variable and then use it later?
Jennifer NordellTreehouse Teacher
Hi there! This is valid, but it sort of depends on what you're going to be using the variable for later. If it's going to be holding a string and you're sure of that, you should at least initialize it with an empty string. There can be unexpected consequences later on if you start trying to concatenate without having given it an initial value as the variable at that point is "Undefined".
Hope this helps!