23 lines
835 B
Mojo
23 lines
835 B
Mojo
# probe: a t-string is a TString of its values' types, not a String: returning one from a function declared -> String is a compile error
|
|
# expect: compile-error
|
|
# note: kept as a checker test; the code below is exactly what godbolt rejected
|
|
# note: kept as a checker test; the code below is exactly what godbolt rejected
|
|
# note: kept as a checker test; the code below is exactly what godbolt rejected
|
|
def label(name: String, score: Int) -> String:
|
|
return t"{name}: {score}"
|
|
|
|
|
|
def main():
|
|
var parts = List[String]()
|
|
for i in range(1, 4):
|
|
parts.append("item" + String(i))
|
|
var joined = String(", ").join(parts)
|
|
print(joined)
|
|
print(label("ada", 1), "|", label("bo", 3))
|
|
var line = String("")
|
|
for i in range(5):
|
|
line += String(i * i)
|
|
if i < 4:
|
|
line += "-"
|
|
print(line)
|