How to write a command for telling a statement immediately after the end of a procedure?

werner.melzer's picture

Hi my dear friends,

 

I’ve developed a simple procedure as follows:

 

> PS:=proc(E)

> if E<10 then E^2

> else 0

> end if:

> printf("V=%d\n",%):

> end proc:

 

I want to write a command that after Entering the >PS:=proc(E) tells users a statement like this: “Please Enter Energy in SI Units as E in this command >PS(E)”  immediately after >end proc: .

How can I do it?

 

Thanks a lot in advance for your precious helps,

Werner Melzer

 

alec's picture

readstat or Maplet

You could use readstat command, but it is better to write a simple Maplet for such a sort of an interaction.

Alec

lemelinm's picture

Here a simple way

> PS := proc ()
local E;
 E := readstat("Enter the value of E :");
 if E < 10 then E:=E^2 else E:=0; end if;
 printf("V=%d\n", E);
 end proc;
> PS();

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}