Non-executed repeat loop robs variable of value/definition
Non-executed repeat loop robs variable of value/definition
- Subject: Non-executed repeat loop robs variable of value/definition
- From: kai <email@hidden>
- Date: Sun, 28 Aug 2005 16:21:56 +0100
OK - this does exactly what I'd expect:
----------
set n to 1
if false then set n to 2
n
--> 1
----------
However, I'm having some difficulty explaining the logic of this,
which results in an error number number -2753 (OSAUndefinedVariable):
----------
set n to 1
if false then repeat with n from 1 to 2
end repeat
n
--> "AppleScript Error: The variable n is not defined."
----------
Similarly:
----------
set n to 1
if false then repeat with n in {2}
end repeat
n
--> "AppleScript Error: The variable n is not defined."
----------
My assumption was that the conditional statement should prevent any
part of the repeat loop from being executed - but this doesn't seem
to be the case. On checking whether or not the behaviour is recent, I
find that it predates OS X...
Can anyone enlighten me on this one?
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden