We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes, the use of an early return is useful.
Perhaps we can add a return statement that acts like fail but instead of failing the procedure, terminates the procedure without failing
return
fail
e.g.
def product(matrix:list(list(int)), ?p:int) { ?p = 1 for ?row in matrix { for ?i in row { if { i = 0 :: ?p = 0; return } !p *= i } } }
The text was updated successfully, but these errors were encountered:
I suppose this example could be solved with the use of a generalised break, taking an optional integer constant, n argument that breaks n loops
break
n
def product(matrix:list(list(int)), ?p:int) { ?p = 1 for ?row in matrix { for ?i in row { if { i = 0 :: ?p = 0 break 2 } !p *= i } } }
Generalised next makes sense too, then
next
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Sometimes, the use of an early return is useful.
Perhaps we can add a
return
statement that acts likefail
but instead of failing the procedure, terminates the procedure without failinge.g.
The text was updated successfully, but these errors were encountered: