PDA

View Full Version : Halting a Procedure



DarknessX
09-04-2007, 07:10 PM
Hey guys... How would you halt JUST the current procedure, but continue with the program from where you are?

IE,


Procedure Exa;
begin
if blue <> green then begin
&#123;...&#125;
end;

if yellow <> input then begin
&#123;...&#125;
end;

if yes = yes then begin
Writeln&#40;'YES!'&#41;;
Halt&#40;Exa&#41;; &#123;halt the current procedure...&#125;
Purple &#58;= 'YES';
end;

Writeln&#40;'No.'&#41;;
Writeln&#40;'Is the answer.'&#41;;
Purple &#58;= 'NO'';
end;

begin
Exa;
Writeln&#40;Purple&#41;;
end.

Result:
YES


How would I do something like that? (NOTE: that is not real code. AFAIK, it will not work.)

technomage
09-04-2007, 07:19 PM
Use the Exit key word. This will exit the current function / procedure and continue from where the procedure was called.