18 lines
520 B
Mojo
18 lines
520 B
Mojo
# probe: comptime constants and expressions used at run time
|
|
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
|
|
# expect-stdout: 8 4 32
|
|
# expect-stdout: #.#.#.#.
|
|
# expect-stdout: hi!
|
|
comptime WIDTH = 8
|
|
comptime HEIGHT = WIDTH // 2
|
|
comptime GREETING = "hi"
|
|
|
|
|
|
def main():
|
|
print(WIDTH, HEIGHT, WIDTH * HEIGHT)
|
|
var row = String("")
|
|
for x in range(WIDTH):
|
|
row += "#" if x % 2 == 0 else "."
|
|
print(row)
|
|
print(GREETING + "!")
|