-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinput.txt
More file actions
84 lines (61 loc) · 1.09 KB
/
Copy pathinput.txt
File metadata and controls
84 lines (61 loc) · 1.09 KB
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
p = 10
q = 1.23
r = true
s = "hello"
print "hello"
a = 100
print "value of a is: " a
b = "hello, again!"
print b
c = " "
print "enter string c:"
read into c
print "value of c is: " c
d = 0.0
print "enter float d:"
read into d
print "value of d is: " d
e = true
print e
x = 2
print "before swapping"
print "value of p is: " p
print "value of x is: " x
swap p x
print "after swapping"
print "value of p is: " p
print "value of x is: " x
print "saving content into file!"
write file "filename.txt" "hello, world!"
append file "filename.txt" "hello, again!"
write file "filename.txt" "overwriting - last hello!"
print "success!"
print "displaying contents of file: \n"
read file "filename.txt"
z = 14
loop if z <= 20 begin
print "hello"
z = z + 2.0
print z
print "heyy"
end
function hello() { print a
a = 10
print "hello function1"
print "value of a is: " a
}
function factorial() { print a
a = 20
print "hello function2"
print "value of a is: " a
z = 5
fact = 1
loop if z > 0 begin
fact = fact * z
z = z - 1
end
print "factorial of 5 is: " fact
}
hello()
factorial()
hello()