← Back to the course
Lesson 1 of 6 · ~8 min

Your First Quantum Program

Build a one-qubit circuit, measure it, and read the outcome.

A quantum program is a circuit: a set of qubits (quantum bits) that start in the state |0⟩, a sequence of gates that transform them, and measurements that read them out as ordinary classical bits.

Qly runs circuits written in OpenQASM. Below is the smallest meaningful program: one qubit, one classical bit to store the result, and a measurement. With no gates in between, a qubit stays in |0⟩ — so every shot measures 0.

OPENQASM 2.0;
include "qelib1.inc";
qreg q[1];
creg c[1];
measure q[0] -> c[0];

qreg declares quantum bits, creg declares classical bits, and measure copies a qubit’s outcome into a classical bit.

◆ Exercise

Complete the circuit so it measures the single qubit. Run it — since there are no gates, you should measure |0⟩ with certainty.

? Quick check
1. What state does every qubit start in?
Adapted from QWorld’s QBronze workshop, licensed CC-BY-4.0. Learn more about QWorld →