Use case: early termination
@squin.kernel
def return_zero(n):
if n <=0:
return n
else:
return return_zero(n-1)
raises BuildError: Early returns/terminators in if bodies are not supported with structured control flow
Yes this can be restructured as
@squin.kernel
def return_zero(n):
if n > 0:
return return_zero(n-1)
return n
That is a structural change in code to comply with compiler needs.
Use case: early termination
raises
BuildError: Early returns/terminators in if bodies are not supported with structured control flowYes this can be restructured as
That is a structural change in code to comply with compiler needs.