The first program most programmers write is a "Hello world!" program. This article will discuss how to do this in YASS.
Display methods
For this computer program to have a meaningful output, it must send something
to the display, in this case, "Hello world". Most languages offer
a method for sending information to the console through the means of
standard out (stdout) such as a print
method.
YASS is no different.
print("Hello world")
Program entry points
Most programming languages need programs to have an entry point. Some languages such as ZPE, Python and JavaScript define an entry point themselves (in some cases they look for an entry point but if they don't see one they will see the whole program as this).
An entry point is basically where the program begins. VB.NET is one language that
does not necessarily make an entry point clear to user, but in the VB.NET console
applications it is clear from the fact that it defines it's first subroutine as the
Main
subroutine.
When a program is written in C, you start with the main function. This is the entry point:
int main(){ return 0; }
In Java, you write the entry point as a main function too:
public static void main(String args) { }
In ZPE you don't need to explicitly write an entry point, but it is often found as it actually faster when it comes to compilation and interpreting programs. This is done with:
function main() end function
The purpose of this entry point is to define the first thing the computer
will do when it starts the program. In the Hello World program written in YASS,
the print
statement would be within the entry point function:
function main() print("Hello world!") end function