-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntax.txt
51 lines (42 loc) · 1.17 KB
/
syntax.txt
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
51
import "infinity.in";
define N 4
/- declaring the starting point of the application.
- if this is omitted, the default is "main".
-/
start main;
// one-line functions :D
func my_pow(int x) -> int => x * x;
// if return type not specified, default is void
func main(int argc, Array<string> argv) -> int {
int x = (50 + 7) / 3^(4 - 3!) - 1;
string s = "hello world";
bool b = true;
Array<int> arr = [1, 2, 3];
[int] arr = [1, 2, 3];
if (x > 4) {
x = 0;
} else if (x == 4) {
x = 1;
} else {
x = 10;
}
while (i < x) {
// ...
}
loop 3 times {
loop i: 3 times {
loop i: 1 to 10 times {
// like a for loop that runs `x` times
// another option for a short for-loop is the second line that assigns the loop counter to a variable
// third option is a custom range to the loop counter (all values must be integers)
}
my_pow(1 + 2 * 40 / 5);
// swaps the value of two variables of the same type
swap x, y;
// THINK HOW TO IMPLEMENT PRINT
print(x);
// THINK HOW TO IMPLEMENT INPUT
// like c or like python
input(max_num_of_characters);
return 0;
}