22 lines
577 B
Mojo
22 lines
577 B
Mojo
# probe: overloaded functions picked by count and by type
|
|
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
|
|
# expect-stdout: an Int 3
|
|
# expect-stdout: a String hi
|
|
# expect-stdout: a pair 1,2
|
|
def describe(x: Int) -> String:
|
|
return "an Int " + String(x)
|
|
|
|
|
|
def describe(x: String) -> String:
|
|
return "a String " + x
|
|
|
|
|
|
def describe(x: Int, y: Int) -> String:
|
|
return "a pair " + String(x) + "," + String(y)
|
|
|
|
|
|
def main():
|
|
print(describe(3))
|
|
print(describe("hi"))
|
|
print(describe(1, 2))
|