Skip to content

Commit 8424cb7

Browse files
committed
Added Clockhands (changed hello by adding a main def)
1 parent 76e1892 commit 8424cb7

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

mojo/clockhands.mojo

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def pad(n) -> String:
2+
return ("0{}" if n < 10 else "{}").format(n)
3+
4+
def main():
5+
for i in range(11):
6+
t = (43200 * i + 21600) // 11
7+
h = t // 3600
8+
m = t // 60 % 60
9+
s = t % 60
10+
print("{}:{}:{}".format(pad(h or 12), pad(m), pad(s)))
11+
12+
13+
https://gist.github.com/modularbot/cc4f5e8c5d6e2789a5b9b0328b2174bd

mojo/hello.mojo

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
print("Hello, world")
1+
def main():
2+
print("Hello, world")

0 commit comments

Comments
 (0)