Skip to content

Commit dc7dc93

Browse files
committed
example update
1 parent abbfa12 commit dc7dc93

File tree

3 files changed

+85
-85
lines changed

3 files changed

+85
-85
lines changed

examples/api.bug

Lines changed: 0 additions & 19 deletions
This file was deleted.

examples/class.bug

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import "math";
2+
3+
class A(){
4+
func init(){
5+
this.name = "A";
6+
}
7+
8+
func getName(){
9+
return this.name;
10+
}
11+
}
12+
13+
class B(){
14+
func init(){
15+
this.name = "B";
16+
}
17+
func getName(){
18+
return this.name;
19+
}
20+
}
21+
22+
class C(B, A){
23+
func init(){
24+
super(A).init();
25+
println(this.name);
26+
super(B).init();
27+
println(this.name);
28+
this.name = "C";
29+
}
30+
func getName(){
31+
return this.name;
32+
}
33+
}
34+
35+
c = new C();
36+
println(c.getName());
37+
38+
var users = [
39+
{
40+
"name": "Samandar",
41+
"age": 20,
42+
"id": 1,
43+
},
44+
{
45+
"name": "Nomalum",
46+
"age": 100,
47+
"id": 2,
48+
}
49+
];
50+
i = 0;
51+
52+
for (i < users.size()){
53+
user = users[i];
54+
println();
55+
println("id: ", user["id"]);
56+
println("name: ", user["name"]);
57+
println("age: ", user["age"]);
58+
println();
59+
i = i + 1;
60+
}
61+
62+
var numbers = [20.4324, 324.423432, 10.21];
63+
numbers.append(20.1122);
64+
i = 0;
65+
for (i < numbers.size()){
66+
println(math.round(numbers[i], 2));
67+
i = i + 1;
68+
}
69+
70+
println("salom\r\nqalaysan")

examples/index.bug

Lines changed: 15 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,19 @@
1-
import "math";
1+
header("Content-Type", "application/json");
2+
import "json";
3+
// import "psql";
24

3-
class A(){
4-
func init(){
5-
this.name = "A";
6-
}
5+
// db = new psql.DB("db");
6+
// query = db.query("select * from users");
77

8-
func getName(){
9-
return this.name;
10-
}
11-
}
12-
13-
class B(){
14-
func init(){
15-
this.name = "B";
16-
}
17-
func getName(){
18-
return this.name;
19-
}
20-
}
21-
22-
class C(B, A){
23-
func init(){
24-
super(A).init();
25-
println(this.name);
26-
super(B).init();
27-
println(this.name);
28-
this.name = "C";
29-
}
30-
func getName(){
31-
return this.name;
32-
}
33-
}
34-
35-
c = new C();
36-
println(c.getName());
37-
38-
var users = [
39-
{
40-
"name": "Samandar",
41-
"age": 20,
42-
"id": 1,
43-
},
44-
{
45-
"name": "Nomalum",
46-
"age": 100,
47-
"id": 2,
48-
}
8+
// users = query.findAll();
9+
// print(users);
10+
var data = [
11+
_GET, _POST, _REQUEST, _GLOBALS
4912
];
50-
i = 0;
51-
52-
for (i < users.size()){
53-
user = users[i];
54-
println();
55-
println("id: ", user["id"]);
56-
println("name: ", user["name"]);
57-
println("age: ", user["age"]);
58-
println();
59-
i = i + 1;
60-
}
61-
62-
var numbers = [20.4324, 324.423432, 10.21];
63-
numbers.add(20.1122);
64-
i = 0;
65-
for (i < numbers.size()){
66-
println(math.round(numbers[i], 2));
67-
i = i + 1;
68-
}
6913

70-
println("salom\r\nqalaysan")
14+
println(
15+
[
16+
json.decode("{\"name\":1}"),
17+
json.encode(data)
18+
]
19+
);

0 commit comments

Comments
 (0)