-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.gelo
47 lines (41 loc) · 1.11 KB
/
example.gelo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function helloWorld(){
var helloWorld = "Hello World!";
console.log(helloWorld);
}
function spawnFuns(){
var me = self();
thread.spawn(spawnFuns2(me));
var b = thread.receive();
console.log(b);
}
function spawnFuns2(parent){
thread.send(parent, @hello_parent);
}
function listsExample(){
var list = [1,"hej",3,4];
for(0, length(list), 1, function(i){
console.log(list[i]);
});
for(length(list)-1, 0, 1, function(i){
console.log(list[i]);
});
}
function foreach_example(){
var list = [ [{@firstname, "Gelo"}, {@lastname, "son of Deinomenes"}]
, [{@firstname, "Fredrik"}, {@lastname, "Gustafsson"}]
];
foreach(list, function(element){
console.log(element.firstname);
});
}
function webServer(){
var port = 1337;
server.create( port
, function(request, socket){
console.log(request.url);
server.send(socket, 200, "Content-Type: text/html", "Hello World");
});
}
function callAnotherMod(){
example_two.helloGELO();
}