-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.notjs
More file actions
54 lines (46 loc) · 982 Bytes
/
example.notjs
File metadata and controls
54 lines (46 loc) · 982 Bytes
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
// Fibonacci sequence with while
let a = 0;
let b = 1;
let i = 1;
while (i <= 25) {
println "The " + i + " Fibonacci number is " + a + ".";
let temp = a;
a = b;
b = temp + b;
i = i + 1;
}
println "";
// A simple console drawing program
let message = "EMAG EHT TSOL UOY"
let height = 10
let width = 50
let x = 0
while (x < height) {
let y = 0
while (y < width) {
if (x == 0 | x == height - 1 | y == 0 | y == width - 1) {
print "*"
} else {
let midX = height / 2
let midY = width / 2 - message.length / 2
if (x == midX - 1 & y == midY - 1) {
let msgiter = message.length - 1
while (msgiter >= 0) {
print message[msgiter]
msgiter -= 1
}
y = y + message.length - 1
} else {
print " "
}
}
y += 1
}
println ""
x += 1
// Skip one line at the bottom half to make it even
if (x == height - 2) {
x += 1
}
}
println ""