-
Notifications
You must be signed in to change notification settings - Fork 1
Hello World
This is the traditional "Hello World!" program implemented in Evi:
Let's break this down line by line.
The file starts with a preprocessor directive: #apply "std/io"
. This lets the compiler know that we'll be using the input/output header from the standard library, which includes functions like puts
. (More on including files can be found in §6.1).
Then comes the declaration/definition of the main
function. This function must be defined in each project and is the entry point of the program. (More on that here).
Immediatly after that comes the body
of the function. In this case it consists of only one statement, so curly braces aren't necessary.
The statement is a call of the puts
function. This simply calls the function from the "std/io" header that prints a string. Since there's no return statement, the integer value 0 is then implicitly returned.
That's everything that makes up a "Hello World!" program in Evi. You can test it (and validate your Evi installation) by compiling and running it using the following commands:
user@host:/some/directory $ evi hello_world.evi # your file
user@host:/some/directory $ ./hello_world
Hello World!
user@host:/some/directory $ _
on Linux, or
C:\Some\Directory> evi hello_world.evi # your file
C:\Some\Directory> ./hello_world.exe
Hello World!
C:\Some\Directory> _
on Windows (not yet officially supported).
The Hello World example and others can be found in the test/
directory of the Evi github repository.
Next: 3 – Basic Concepts
Home | About | Installation | Language Overview | License: MIT 2022 Sjoerd Vermeulen. Terms