Transcript from the "Undefined vs Undeclared" Lesson
>> Kyle Simpson: Let's make sure we're fully clear on this whole undefined versus undeclared thing. Might be review for some of you but let's just make sure we're fully clear. What is the difference between undefined and undeclared? Anyone?
>> Speaker 2: You're declaring this variable exist, I'm not assigning it a value but it exist.
>> Kyle Simpson: Okay, that's true.
>> Speaker 2: So there it's declared but not defined.
>> Kyle Simpson: Okay.
>> Speaker 3: Undeclared.
>> Kyle Simpson: All right, that's part of it, you're on the right track but that's not all of it yet.
>> Speaker 3: Undeclared has have never had the memory allocated during the compiler parsing stage whereas undefined.
[00:00:40] Maybe it was allocated but there's never been a value assigned to that.
>> Kyle Simpson: Putting both of your answers together we can get the complete answer. So let me restate that. You are both correct. You're on the right track so let me restate this. The difference between these two, undefined means a variable exists but at the moment it has no value.
[00:00:59] It may have never had a value or it might have used to have a value and it doesn't anymore but there is no other value in the vacuum of space it is undefined, right? Undeclared even though they sound like synonyms undeclared is actually never formally declared in any scope that we have accessed to.
[00:01:43] We need to keep these two concepts separate. There's a different something being undeclared doesn't exist, and being undefine definitely it does exist, but doesn't have a value.