-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcasual-coding.mar
35 lines (30 loc) · 1.11 KB
/
casual-coding.mar
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
import stdlib.mar
fun main(): Never {
println("<h1>Welcome to Marcel's website!</h1>")
println("This website runs Martinaise compiled to Soil interpreted in JavaScript in your browser.")
print("<br>Here is FizzBuzz:")
for i in 1..=100 do {
var fizz = i % 3 == 0
var buzz = i % 5 == 0
if i > 1 then print(", ")
print(
| if fizz and buzz then " <b style=\"color:#8b3ca8;font-size:40px;font-weight:bold;\">fizzbuzz</b>"
if fizz and buzz then " <img style=\"max-width:40px;border-radius:50%;background-color:white;\" src=\"https://marcelgarus.dev/me.webp\">"
else if fizz then " <b style=\"color:red;font-size:30px;\">fizz</b>"
else if buzz then " <b style=\"color:blue;font-size:30px;\">buzz</b>"
else "{i}"
)
}
println()
println("<br>Here are recursively calculated Fibonacci numbers with a font size scaled to their value:<br>")
for n in 0..infinity do {
var res = fib(n)
if n > 0 then print(", ")
print("<span style=\"font-size:{max(1, res/10)}px\">{res}</span>")
}
exit(0)
}
fun fib(n: Int): Int {
if n < 2 then return n
fib(n - 1) + fib(n - 2)
}