forked from willumz/generic-pseudocode-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.pseudo
112 lines (82 loc) · 1.38 KB
/
example.pseudo
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# ----------
x = 4 MOD 13
y = 2 DIV 3
z = 2 ^ 3
if x == true and y == false or z == true then
// do something
end if
x = not x
/* --------- */
x = 1
if x == 1 then
print "x = 1"
else if x == 2 then
print "x != 1"
end if
// -------------
y = 2
while y <= 10
OUTPUT y
y++
end while
// -------------
for i = 1 to 10
print i
next i
// -------------
foreach (i in iterable)
print i
next i
// -------------
a = "x"
switch a
case "x":
print "a = 'x'"
break
case "y":
print "a = 'y'"
break
end switch
// -------------
try
MakeError()
catch (err)
print err
end try
// -------------
function Add(a, b)
return a + b
end function
function add() {
return 1 + 2
}
// -------------
procedure HelloWorld()
print "Hello World"
end procedure
subroutine HelloWorld()
print "Hello World"
end subroutine
// -------------
class A
procedure new()
print "Constructed"
end procedure
end class
class A extends B
procedure new()
print "Constructed"
end procedure
end class
public abstract class A extends B
public procedure new()
print "Constructed"
end procedure
private static procedure HelloWorld()
output "Hello World"
end procedure
readonly protected x = "11"
abstract function x(num, poo, lol)
return num
end function
end class