You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently a function containing multiple return statements will short circuit upon evaluating the first one.
This is incorrect behavior because we need to evaluate the entirety of each function to satisfy R1CS constraints.
Changes
function main(cond: bool) -> u32{if cond {return1u32}else{return0u32}}
In the above function there are two return statements whose results depend on a cond input boolean.
We can conditionally select the desired result from the conditional by passing this cond as an indicator to the function main when it is ready to return.
As expected, return arguments will no longer terminate a function early. Instead, they will pass their result along with their indicator to the function main when it is ready to return.
The text was updated successfully, but these errors were encountered:
Overview
Currently a function containing multiple return statements will short circuit upon evaluating the first one.
This is incorrect behavior because we need to evaluate the entirety of each function to satisfy R1CS constraints.
Changes
In the above function there are two return statements whose results depend on a
cond
input boolean.We can conditionally select the desired result from the conditional by passing this
cond
as an indicator to the functionmain
when it is ready to return.As expected, return arguments will no longer terminate a function early. Instead, they will pass their result along with their indicator to the function main when it is ready to return.
The text was updated successfully, but these errors were encountered: