Difference between revisions of "Hello World"

From vishap oberon compiler
Jump to navigation Jump to search
Line 1: Line 1:
{{language navigation|Main Page}}
+
{{language navigation|Hello World}}
  
* Write "Hello World" program in Oberon-2 [[Hello_World/en]]
+
Now let's write a "hello world" program and compile it using voc.
* Օբերոն-2 լեզվում «Բարև Աշխարհ» ծրագիրը՝ [[Hello_World/hy]]
+
 
*
+
Create a new file named <code>foo.Mod</code> and insert in it the following code.
 +
 
 +
<pre>
 +
MODULE hello;
 +
 
 +
IMPORT Console;
 +
 
 +
BEGIN
 +
 
 +
Console.String ("Hello World!");
 +
Console.Ln
 +
 
 +
END hello.
 +
</pre>
 +
 
 +
Which means
 +
 
 +
MODULE hello — The module's name is hello.
 +
 
 +
IMPORT Console — Import the module Console.
 +
 
 +
BEGIN — Here we start our code!
 +
 
 +
Console.String ("Hello World!"); — Module Console, Procedure String (which is going to show a sting on our console) Hello World!
 +
<br/>Console.Ln; — Print a line on the Console.
 +
 
 +
END hello. — End of the module hello, and let's not forget the dot. (:
 +
 
 +
Now let's compile it!
 +
 
 +
<code>voc -m foo.Mod</code>
 +
 
 +
and now let's run it!
 +
 
 +
<pre>
 +
$ ./hello
 +
Hello World!
 +
 
 +
$
 +
</pre>
 +
 
 +
End article.

Revision as of 03:14, 5 December 2014

Deutsch (de) | English (en) | հայերեն (hy)

Now let's write a "hello world" program and compile it using voc.

Create a new file named foo.Mod and insert in it the following code.

MODULE hello;

IMPORT Console;

BEGIN

Console.String ("Hello World!");
Console.Ln

END hello.

Which means

MODULE hello — The module's name is hello.

IMPORT Console — Import the module Console.

BEGIN — Here we start our code!

Console.String ("Hello World!"); — Module Console, Procedure String (which is going to show a sting on our console) Hello World!
Console.Ln; — Print a line on the Console.

END hello. — End of the module hello, and let's not forget the dot. (:

Now let's compile it!

voc -m foo.Mod

and now let's run it!

$ ./hello
Hello World!

$

End article.