The Oberon Programming Language

Hello World! Example Program


Click below to go directly to a specific section:
Description | Source Code | Sample Run | Program Notes

Description


This code demonstrates the usage of Oberon's Texts module. W is used as text writer stream. Output is displayed to the oberon's Log window by appending the buffer of the writer stream to Oberon.log

Source Code

(* This is designed to run Under Oberon V4 *)

MODULE Hello;
         IMPORT Oberon, Texts;
  VAR W: Texts.Writer;
  
  PROCEDURE World*;
  BEGIN
    Texts.WriteString(W, "Hello World!");
    Texts.WriteLn(W);
    Texts.Append(Oberon.Log, W.buf);
  END World;

BEGIN
  Texts.OpenWriter(W);
END Hello.

Sample Run

Once this module is compiled, Executing the command Hello.World will print "Hello World!" to the system log

Program Notes

This program tested on Oberon V4 Windows 32 bit version. When you create a new file Hello.Mod in Oberon's editor (Edit.Open Hello.Mod), select this text now and copy it it to the clipboard (File/Copy), paste it into Hello.Mod by placing the caret in that window and executing Clipboard.Copy command anywhere on the screen. Compiling is done by placing a marker (F1 key) on Hello.Mod window and running Compiler.Compile * in the System.Tool.


[Back] [Home]