Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!usc!elroy.jpl.nasa.gov!ames!haven!adm!news From: CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) Newsgroups: comp.lang.pascal Subject: Re:IMPLEMENT GOTO ACROSS MODULES IN TURBO PASCAL?? Message-ID: <25404@adm.brl.mil> Date: 5 Jan 91 22:06:40 GMT Sender: news@adm.brl.mil Lines: 45 In article <11647@j.cc.purdue.edu>, zhou@brazil.psych.purdue.edu (Albert Zhou) wrote: >Here is the problem: > Suppose there is such a structure in the main part of the >program: > > repeat > statemetn 1 > statement 2 > . > . > . > statement n > until whatever > > Now I need to write a subroutine to point the program to statement >n. It seems there is no way to do it in turbo pascal, since goto >statement can not go out of a subroutine. Try reworking your repeat statement so that each statement 1..n has an associated value. Set that value in the subroutine(s). The loop would look something like: var flag_val : byte; ... flag_val := 0; repeat if flag_val <= 1 then statement1; if flag_val <= 2 then statement2; ... if flag_val <= n then statementn; flag_val := 0; until whatever; (Note that appropriate manipulation of flag_val allows statementI to cause a skip of a range of following statements I+1..n.) +--------------------------------------------------------------------+ | Karl Brendel Centers for Disease Control | | Internet: CDCKAB@EMUVM1.BITNET Epidemiology Program Office | | Bitnet: CDCKAB@EMUVM1 Atlanta, GA, USA | | Home of Epi Info 5.0 | +--------------------------------------------------------------------+