Why does Taichi not support return statements inside if/while/for scopes?

I was reading the documentation here. Why is there this limitation and will it be addressed in the future? Thanks!

Hi @irenedea , welcome to the Taichi community.

In the taichi scope (ti.kernel, ti.func), the outmost loops might parallel run. Each loop is independent. If you terminate one, others can still run. The programs will terminate until all loops are finished. So it’s better to declare a variable to store the return value.

1 Like