Is there any way to measure before a gate?

I want to measure before some certain gate. How to do that?
Screenshot 2023-02-06 111959

Hi @Rayhan740,

Welcome to the Forum! :smiley:

Unfortunately you cannot measure a qubit and then keep applying gates on that qubit.

You can apply mid-circuit measurements but only on qubits that you will no longer need.

In the PennyLane docs you will find a nice explanation of how to perform mid-circuit measurements and conditional operations.

Does this answer your question? :slight_smile: