4 ms·
Fixed, thank you for the tip. Yeah the point I was showing was that the 'c' exists after the if or else, showing that scope is not bound to indentation level.
by sausagefeet 16y ago
Fixed, thank you for the tip. Yeah the point I was showing was that the 'c' exists after the if or else, showing that scope is not bound to indentation level. On the subject of scope, this behavior has gotten me a few times (I find it unintuitive although I understand why it works this way):
x = 2
f = lambda : x
print f()
x = 3
print f()
- euccastro 16y agoYes, the first assignment works as a Scheme 'define', and all subsequent ones as 'set!'s. The whole function/class/module is a monolithic scope, inherited/superseded/extended by functions and classes defined within.