Hello

Users who are viewing this thread

ssl

Banned
Messages
4,095
Reaction score
1
Tokenz
0.00z
Code:
[FONT=Courier New]#p:hello;init()
#l:disp[core/display];init("terminal")

byte:init()
    disp.printLine("Hello.")[/FONT]
What does it do?

Besides the obvious.. ;)
 
  • 8
    Replies
  • 361
    Views
  • 0
    Participant count
    Participants list

ssl

Banned
Messages
4,095
Reaction score
1
Tokenz
0.00z
Code:
[FONT=Courier New]#p:hello;init()
#l:disp[core/display];init("terminal")

byte:init()
    disp.printLine("Hello.")[/FONT]
What does it do?

Besides the obvious.. ;)

Well, the two top lines are preprocessor directives.

Preprocessor directives tell the compiler about some information that is vital to the compilation process. In this case, the first one breaks down as such:

# - signifies a preprocessor directive
p - signifies the program preprocessor directive
: - a delimiter between directive and name
hello - the name of the program
; - a delimiter between the name and initial function call
init() - the function to call when the program starts

the same goes for the #l line, except that the programmer has specified, by the [...] characters, the path to the library they wish to attribute to the disp variable; by omitting the location path, the compiler will search, by name, in the library cache (a collection of libraries)

the item of interest is the initial function call; this allows you to build custom libraries, which may have the same name, such as display for graphics as well as terminals, and use only portions.
 
78,874Threads
2,185,387Messages
4,959Members
Back
Top