Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : FUNCTION.MOD

 
Output of file : FUNCTION.MOD contained in archive : M2TUTOR.ZIP
(* Chapter 5 - Program 6 *)
MODULE Function;

FROM InOut IMPORT WriteString, WriteInt, WriteLn;

PROCEDURE QuadOfSum(Number1, Number2 : INTEGER) : INTEGER;
BEGIN
RETURN(4*(Number1 + Number2));
END QuadOfSum;

VAR Dogs, Cats, Feet : INTEGER;

BEGIN (* Main program *)
Dogs := 4;
Cats := 3;
Feet := QuadOfSum(Dogs,Cats);
WriteString("There are a total of");
WriteInt(Feet,3);
WriteString(" paws.");
WriteLn;
END Function.




(* Result of execution

There are a total of 28 paws.

*)



  3 Responses to “Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : FUNCTION.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/