|
|
|
|
|
by MyOutfitIsVague
331 days ago
|
|
> Compare with the if statement, where the variable in the expression being tested will necessarily be defined. if False:
x = 7
print(x)
print(x)
^
NameError: name 'x' is not defined
Ruby does this sort of stuff, where a variable is defined more or less lexically (nil by default). Python doesn't do this. You can have local variables that only maybe exist in Python. |
|