-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.srpl
67 lines (51 loc) · 1.53 KB
/
main.srpl
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
task add with a and b contains
flush a plus b end
variable result is execute add with 3 & 5 now
variable sum is add
variable otherResult is execute sum with 4 & 5 now
flush result
flush otherResult
variable i is 1
while i is_less_than 5 then
variable i is i plus 1 end
flush i
task odd with n contains
flush if n is_equal_to 0 then
0 else execute even with n min 1 now end end
task even with n contains
flush if n is_equal_to 0 then
1 else execute odd with n min 1 now end end
variable evenCopy is even
flush execute even with 4 now
flush execute odd with 4 now
flush execute evenCopy with 3 now
flush execute odd with 3 now
task apply with number and lambda contains
execute lambda with number now end
task makeTwenty with n contains
variable n is 20
flush n end
variable wasntTwenty is 18
variable wasntTwenty is execute apply with wastnZero & makeTwenty now
flush wasntTwenty
task sommig with n contains
variable result is 0
while n is_greater_than_or_equal_to 1 then
variable result is result plus n
variable n is n min 1 end
flush result end
flush execute sommig with 5 now
flush execute sommig with 34 now
task fact with n contains
variable result is 1
for variable i is 2 to n plus 1 then
variable result is result multiplied_by i end
flush result end
flush execute fact with 5 now
flush i
task neg_for with n contains
variable result is 1
for variable i is 10 to 0 step min 2 then
variable result is result plus i end
flush result end
flush execute neg_for with 5 now