Sha256: 7c483cd28f5e6332188584719edda818f161032feac528d284fc360b781dab7a

Contents?: true

Size: 913 Bytes

Versions: 10

Compression:

Stored size: 913 Bytes

Contents

MODULE Hello;
IMPORT InOut;

BEGIN
  InOut.WriteString('Hello world!');
  InOut.WriteLn
END Hello.
==={{header|TopSpeed Modula-2}}===
{{works with|TopSpeed (JPI) Modula-2 under DOSBox-X}}
Modula-2 does not have built-in procedures for I/O. Instead, I/O is done via library modules. The names and contents of these modules vary between implementations of Modula-2. The solution below shows that the console I/O module supplied with TopSpeed Modula-2 has a different name and different procedures from the implementation in the previous solution.

MODULE Hello;
IMPORT IO;

BEGIN
  IO.WrStr('Hello world!'); IO.WrLn;

(* Another way, showing some features of Modula-2 *)
  IO.WrStr("Hello");  (* either single or double quotes can be used *)
  IO.WrChar(40C);     (* character whose ASCII code is 40 octal *)
  IO.WrStr('world!');
  IO.WrLn();          (* procedure with no arguments: () is optional *)
END Hello.

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/hello_world.text/modula-2.txt
zettacode-0.1.6 files.zettacode/hello_world.text/modula-2.txt
zettacode-0.1.6 files.zettacode2/hello_world.text/modula-2.txt
zettacode-0.1.5 files.zettacode/hello_world.text/modula-2.txt
zettacode-0.1.5 files.zettacode2/hello_world.text/modula-2.txt
zettacode-0.1.4 files.zettacode/hello_world.text/modula-2.txt
zettacode-0.1.4 files.zettacode2/hello_world.text/modula-2.txt
zettacode-0.1.3 files.zettacode/hello_world.text/modula-2.txt
zettacode-0.1.2 files.zettacode/hello_world.text/modula-2.txt
zettacode-0.1.1 zettacode.files/hello_world.text/modula-2.txt