If you are using the context-manager 《builder》 forms of
while_loop(), you can only call this method if you are within a loop context, because otherwise the 《resource width》 of the operation cannot be determined. This would quickly lead to invalid circuits, and so if you are trying to construct a reusable loop body (without the context managers), you must also use the non-context-manager form of
if_else(). Take care that the
BreakLoopOpinstruction must span all the resources of its containing loop, not just the immediate scope.
- 반환 형식
A handle to the instruction created.
- 예외 발생
CircuitError – if this method was called within a builder context, but not contained within a loop.