This is all happening in a script called by another script which
expects a result.
If we quit early because the condition is not true
then I want to return an alternative result, called "different" below.

I guess I could change all my scripts from my current method
[which shows an error "missing endif" in 4.5.03a, when condition == 0]

  ;; my current method 1
  if(not condition)do
    debug Not true so we quit
    quit("different")
  endif
  debug True so we continue
  result = "something"
  quit(result)

I could habitually use this method instead, which works OK with 4.5.03a:

  ;; method 2
  if(not condition)do
    debug Not true so we quit
    jump exit
  endif
  debug True so we continue
  result = "something"
  quit(result)

  @exit
  quit("different")

------------------------------------------------------

Some people say using Jump is bad programming style and one
should always use [EMAIL PROTECTED] instead.
I don't agree with that, because Jump is sometimes useful.

Anyway I did attempt it with [EMAIL PROTECTED] instead of Jump...

... but the next method is no good because the exit routine always
returns to the lines "endif" then "debug True so we continue",
which should not be run when condition == 0.

  ;; method 3
  if(not condition)do
    debug Not true so we quit
    [EMAIL PROTECTED]
  endif
  debug True so we continue
  result = "something"
  quit(result)

  @exit
  quit("different")

---------------------------------------------------

I also tested using Quit All.

I found that I could make method 3 work by using "quit all" in @exit
or make method 1 work by using "quit all" inside the If routine.
In both cases, Quit All (like Jump) always avoids the error messages,
even when Condition==0 makes the script stop before reading any Endif line.

but I don't like Quit All because
(a) it stops ALL scripts and an unrelated script might be running
and (b) I want my conditional quit to return to the calling script
[with the alternative result "different"].



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/
 



Reply via email to