-
Notifications
You must be signed in to change notification settings - Fork 9
/
quine.bal
50 lines (49 loc) · 1.48 KB
/
quine.bal
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
48
49
50
import ballerina/io;
public function main() returns error? {
string[] xs = [
"import ballerina/io;",
"",
"public function main() returns error? {",
" string[] xs = [",
" ];",
" string x1 = xs[xs.length() - 1];",
" string x2 = xs[xs.length() - 2];",
" check from var [i, x] in xs.enumerate()",
" where i < 4",
" do {",
" io:println(x);",
" };",
" check from var [i, x] in xs.enumerate()",
" where i < xs.length() - 1",
" do {",
" io:println(x1 + x.toBalString() + x2);",
" };",
" io:println(x1 + x1.toBalString());",
" check from var [i, x] in xs.enumerate()",
" where 4 <= i && i < xs.length() - 2",
" do {",
" io:println(x);",
" };",
"}",
",",
" "
];
string x1 = xs[xs.length() - 1];
string x2 = xs[xs.length() - 2];
check from var [i, x] in xs.enumerate()
where i < 4
do {
io:println(x);
};
check from var [i, x] in xs.enumerate()
where i < xs.length() - 1
do {
io:println(x1 + x.toBalString() + x2);
};
io:println(x1 + x1.toBalString());
check from var [i, x] in xs.enumerate()
where 4 <= i && i < xs.length() - 2
do {
io:println(x);
};
}