Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!munnari.oz.au!bruce!trlluna!titan!rhea!sidney From: sidney@rhea.trl.OZ.AU (todd sidney) Newsgroups: comp.sys.acorn Subject: Re: Problem with procedures in BASIC Message-ID: <1991Jun5.002444.719@trl.oz.au> Date: 5 Jun 91 00:24:44 GMT References: <7970@ecs.soton.ac.uk> Sender: news@trl.oz.au (USENET News System) Organization: Telecom Research Labs, Melbourne, Australia Lines: 40 In comp.sys.acorn you write: >I have a small problem with a program I have written. It calls a >procedure to load the window templates into memory and then create the >windows so that the window handles are all set up correctly. However, >when run, the program returns 'Not in a procedure at line 1740' where >line 1740 is the ENDPROC statement. At first I thought that it was I suspect that the problem is not caused by any code within the procedure. It is more likely that during the normal execution of the program the procedure is run without being called as a procedure. I know this sounds cryptic, so I will give an example. 10 REM start of main program 20 ... 30 ... 40.. 200 REM end of main program 1000 DEFPROCfred (or whatever) ... ... the procedure code 1900 ENDPROC Note that the main program does not have an END statement. Thus when the main program has finished running it will continue on into the procedure. Since the procedure has not been "called" an error will occur when execution reached the ENDPROC statement. This error could also occur if you GOTO into the procedure, but you wouldn't be using a goto would you? Todd Sidney t.sidney@trl.oz.au