HELP - calling a Procedure from with a Procedure?? 
Author Message
 HELP - calling a Procedure from with a Procedure??

Hi,

I'm a Pascal newbie who has an embarasingly simple problem, but its really
got
me tearing my hair out... and I haven't got that much left... could someone
shed some light on how to call a procedure from within a procedure.

I've got an IF statement which looks something like:

-----

    IF conditionTrue THEN
    BEGIN
        {call the conditonTrue procedure}
    END
    ELSE
    BEGIN
        {call the conditionFalse procedure}
    END;

-----

Where I've commented out the two lines of code is where I want to call
either the True or False procedure.  The True and False conditions are never
called from within the main program  ... ie. within BEGIN and END.  Which
one gets executed will to depend on the whether the IF statement is True or
False.

Could someone fill in the blanks and restore my urge to learn a programming
language...

Thanks in advance.



Thu, 17 Jul 2003 04:08:55 GMT  
 HELP - calling a Procedure from with a Procedure??


Quote:
>Hi,

>I'm a Pascal newbie who has an embarasingly simple problem, but its really
>got
>me tearing my hair out... and I haven't got that much left... could someone
>shed some light on how to call a procedure from within a procedure.

There's nothing special about it.  What's likely going wrong for you
is that you have to remember to declare the procedures before you make
use of them.  

Your code should look something like this:

procedure IfTrueProc(arg:integer); { This one has one argument}
begin
  ...
end;

procedure IfFalseProc; { This one just happens to have none }
begin
  ...
end;

begin
    IF conditionTrue THEN
    BEGIN
       IfTrueProc(3);      
    END
    ELSE
    BEGIN
      IfFalseProc;
    END;



Thu, 17 Jul 2003 06:55:21 GMT  
 HELP - calling a Procedure from with a Procedure??


Quote:
> Hi,

> I'm a Pascal newbie who has an embarasingly simple problem, but its
> really got me tearing my hair out... and I haven't got that much left...
could
> someone shed some light on how to call a procedure from within a
> procedure.

> I've got an IF statement which looks something like:

[...]

You can simplify this to:

if Condition
  then ConditionTrueProcedure
  else ConditionFalseProcedure;

Where:
"ConditionTrueProcedure" is the name of the procedure you whish to call if
"Condition" evaulates to true, and

"ConditionFalseProcedure" is the name of the procedure you wish to call if
"Condition" evaluates to false.

--
Jay

Jason Burgon - Author of "Graphic Vision"  GUI for DOS/DPMI
=== Free LFN capable Dos/WinDos replacement and ===
=== New Graphic Vision  version 2.11 available from:  ===
http://www.jayman.demon.co.uk



Thu, 17 Jul 2003 05:54:31 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HELP - Calling a procedure from within a procedure - how??

2. Calling a procedure within a procedure

3. Calling procedures in inline assembler : HELP NEEDED!

4. Please help me to call procedures....

5. Calling procedures in inline assembler : HELP NEEDED!

6. PChar Params For Stored Procedure Calls

7. Stored Procedure cannot be called from Delphi App

8. Calling Procedures within Inline Assembly?

9. Calling front-end procedure from server SQL-trigger

10. how can i call a procedure?

11. Calling an Oracle Stored Procedure

12. How to call procedure in package

 

 
Powered by phpBB® Forum Software