-
Notifications
You must be signed in to change notification settings - Fork 4
/
program.fpl
140 lines (105 loc) · 1.74 KB
/
program.fpl
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
m="Placeholder value"
class Falcon{
var=m
func sound(self){
print("Sound!")
}
}
class Peregrine(Falcon){
var=m
func __new__(self){
print("__new__ called")
return super(self).__new__(self)
}
func __init__(self){
print(self)
}
func f(self){
print(self.var)
}
}
x=Peregrine()
y=Peregrine()
a=Peregrine.var
x.var=5
y.var="Value"
b=x.var
x.f()
y.f()
x.sound()
print(x.__bases__)
func f(x,c="A"){
print("Function f says: ","")
print(c)
}
f(1)
dictionary={1:[1,2,3], 2:{1:"A"}, "Hello":"World", [123]:2}
l=list(1,2,3,4,5)
x=object()
y=object()
true = x == y
maybe = x is y
same = x is x
print(500==500)
print("Done")
print(l[3])
print(dictionary[[123]])
try{
if 500 is 200{
raise Exception("500 is not the same object as 200")
}
elif 500 is 500{
raise TypeError("500 is not the same object as 200, but is the same as 500")
}
else{
raise NameError("Else condition reached")
}
}
except Exception e{
print(e)
}
i=0
func x(){
i=i+1
print(i)
if (i==3){
raise ValueError("I is 50!")
}
x()
}
try{
x()
}
except Exception e{
print(e)
}
val=2
print(val.__mul__(5))
func fib(n){
if (n<=1){
return n
}
else{
return fib(n-1)+fib(n-2)
}
}
print(fib(10))
pi=238649.2131693410000000
x=pi*100
print(str(pi))
print(int("1234"))
print(float("10.222"))
for n in [10,20,30]{
print(n)
}
i=0
while i<10{
print(i)
i+=1
}
print(True and False)
print(True or False)
print(not 1==1)
print(100^2)
print(100^2*3)
print(100^6)