ModularM
Modular3y ago
4 replies
뽀삐2

how to use async in mojo?

async fn add_three(a: Int, b: Int, c: Int) -> Int:
    let sum:Int = a + b + c;
    return sum

async fn main():
    let task: Coroutine[Int] = add_three(1, 2, 3)
    let result:Int = await task
    print(result)

I did what mojo bot told me to do, but I got the error below.
/__w/modular/modular/Kernels/mojo/builtin/_startup.mojo:70:1: error: caller input parameter #0 has type '!kgen.signature<() async -> !lit.none>' but callee expected type '!kgen.signature<() -> !lit.none>'
mojo: error: failed to run the pass manager
Was this page helpful?