Zain Raza (he/him)
MModular
•Created by Zain Raza (he/him) on 12/31/2023 in #questions
Are Type Hints Still Possible in Mojo?
Hi all - I was wondering, is there a way to write a
def
function in Mojo that uses type hints like in Python 3?
For example I tried writing this earlier. I'm guessing it's not the right approach though, as the compiler gives a warning that cannot use a dynamic value in type specification
Although in this case, I suppose it'd be a better idea to use the built-in Int
type, to let others know what kind of value x
is expecting?5 replies