[futurebasic] Re: Break ... Until

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

From: jonathan <jonathan@...>
Date: Fri, 26 Dec 97 18:06:06 -0000
>For years I appear to have been suffering from the delusion that I knew how
>to program in BASIC.
>
>I've been trying to debug this code:
>_____________________________________
>GLOBALS
>DIM x
>DIM programEnds
>END GLOBALS
>x=0
>programEnds=0
>
>LOCAL FN beeper
>  DO
>    BEEP
>  UNTIL x=1
>END FN
>
>LOCAL FN handleBreak
>  x=1
>  programEnds=1
>END FN
>
>LOCAL FN doTimer
>  FN beeper
>END FN
>
>ON BREAK FN handleBreak
>ON TIMER(2) FN doTimer
>DO
>  HANDLEEVENTS
>UNTIL programEnds
>_____________________________________
>
>Debug? Debug? Whats to debug? Should just run as is!

pete,

I'm afraid that I don't understand your code.

X is initialised as 0
This means that the do/until loop in FN beeper never ends.

When you press CMD_dot to end
your program'll quit.
that's all

There's no way the changed info
can get to the beeper FN.
FB'll loads the info into the variables
just before chucking out the babe
and bath water.


GLOBALS
DIM x
DIM gProgramEnds
DIM gTimer&
END GLOBALS
'-------------------
x = 0 : gProgramEnds = 0
gTimer& = FN TICKCOUNT

WINDOW 1
CLS
'------------------
LOCAL FN HandleBreak
 BEEP:BEEP:BEEP
END FN
'------------------
LOCAL FN myFastIdle
 '  Adjust the 30 to give time you want
 LONG IF (( gTimer& + 30) < FN TICKCOUNT)
  gTimer& = FN TICKCOUNT
  PRINT "Hi Pete"
 END IF
END FN
'-----------------
ON BREAK FN handlebreak
DO
 HANDLEVENTS : FN myFastIdle
UNTIL gProgramEnds

This should do what you're trying to do.
The fast Idle periodically does something
adjustable in time

The Break routine should beep on leaving.

jonathan



'-------------------------------------------------------------'
'  format utile - studio de graphisme/graphic design studio   '
'    mail: 16, rue Baudin, 92300 Levallois-Perret, France     '
'    phone: +33 1 47 15 26 15   -   fax: +33 1 47 59 95 06    '
'-------------------------------------------------------------'