[futurebasic] Re: Break ... Until

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Peter Bancroft <pbancroft@...>
Date: Sat, 27 Dec 1997 18:28:14 +1100
Ok

Rick got me wondering which control structures allowed the use of ON BREAK
to use Cmd . to stop the program.

I did some more experimenting after a sleep.

Cmd . doesn't work with Do ... Until, or While ... Wend .
Cmd. does work with Select ..., and If ...

More importantly, you cannot change a glogal variable based on executing a
HANDLEEVENTS in some other part of a program and have it influence an
executing Do ... Until, or While ... Wend loop.

An example follows at the end of this email.

Thanks to everyone who helped.

I have changed my attitude toward control structures after this.

It would be great if the next FB manual is more specific about this 8)

Peter
peter@...

Example follows:
________________________________
GLOBALS
DIM x
DIM programEnds
END GLOBALS
x=0
programEnds=0

LOCAL FN beeper3		'cmd . works
  SELECT x
    CASE 0
      BEEP
  END SELECT
END FN

LOCAL FN beeper2             	'cmd . works
  IF x=0 THEN BEEP
END FN

LOCAL FN beeper1             	'cmd . doesn't work
  WHILE x=0
    BEEP
  WEND
END FN

LOCAL FN beeper              	'cmd . doesn't work
  DO
    BEEP
  UNTIL x=1
END FN

LOCAL FN handleBreak
  x=1
  programEnds=1
END FN

LOCAL FN doTimer
  FN beeper3
END FN

ON BREAK FN handleBreak
ON TIMER(2) FN doTimer
DO
  HANDLEEVENTS
UNTIL programEnds