qiskit.circuit.QuantumCircuit.break_loop¶
- QuantumCircuit.break_loop()[source]¶
Apply
BreakLoopOp
.Avertissement
If you are using the context-manager « builder » forms of
if_test()
,for_loop()
orwhile_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 ofif_test()
andif_else()
. Take care that theBreakLoopOp
instruction must span all the resources of its containing loop, not just the immediate scope.- Type renvoyé
- Renvoie
A handle to the instruction created.
- Lève
CircuitError – if this method was called within a builder context, but not contained within a loop.