%debug

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

The Modern QDK only supports the '%%qsharp' magic command.

Summary

Steps through the execution of a given Q# operation or function.

Description

This magic command allows for stepping through the execution of a given Q# operation or function using the QuantumSimulator.

Required parameters

  • Q# operation or function name. This must be the first parameter, and must be a valid Q# operation or function name that has been defined either in the notebook or in a Q# file in the same folder.
  • Arguments for the Q# operation or function must also be specified as key=value pairs.

Examples for %debug

Example 1

Step through the execution of a Q# operation defined as operation MyOperation() : Result:

In []: %debug MyOperation
Out[]: <interactive HTML for stepping through the operation>

Example 2

Step through the execution of a Q# operation defined as operation MyOperation(a : Int, b : Int) : Result:

In []: %debug MyOperation a=5 b=10
Out[]: <interactive HTML for stepping through the operation>