Thanks Sean,
So: quit(win.debug("Not true so we quit")++"different")
executes the win.debug and only "different" is returned.
I didn't know we can do that.
Another interesting trick which only Sean knows about :)
That would fix the small examples I showed, but I'm looking for
a more general solution. In real cases I sometimes want to do more
than just debug before the conditional quit.
In the final product I want to show a message box, not use debug,
plus I may need to calculate a suitable return value for the Quit.
Therefore I cannot use If() instead of If()do as you suggested.
So my main question remains, Which would Bruce prefer:
[A] Bruce modifies the new error routines in 4.5.03a
so we can Quit or Quit(result) from inside an if()do
before its Else or Endif, with no error message
[like we can Jump out of it].
or [B] users restructure any existing scripts which
conditionally Quit from inside an if()do
I could restructure all my scripts like this,
which works with 4.5.03a
if(not validpath(arg(1))do
;; this is for exceptional events such as a file does not exist
<maybe show a message box "no such file">
<maybe set a static and/or calculate a value for zReturn>
else
;; this is the main part, which is usually executed
<many lines which calculate the value of zResult>
endif
quit(zResult)
Advantage: maybe ? a more elegant structure and I should have
written my scripts like that in the first place.
Disadvantages:
- That involves editing several long scripts now,
moving the main part of each routine into an else section.
- It would create some deep nesting of Ifs because the main
part usually contains nested If()do structures.
- Harder to understand the structure without a lot of vertical
scrolling, because the endif belonging to the first if()do
gets moved a long way down the page.
For that reason I would probably use a jump to exit instead.
if(not validpath(arg(1))do
;; this is for exceptional events such as a file does not exist
<maybe show a message box "no such file">
<maybe set a static and/or calculate a value for zReturn>
jump exit
endif
;; this is the main part, which is usually executed.
;; no need to nest it inside the if()do structure above.
@exit
quit(zReturn)
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/