Course / Module 6
Module 6 of 7

Testing and debugging

Proving a program is correct, and reading the execution trace when it is not.

testing tracing debugging confidence

Writing a program that runs is half the job. Knowing it does the right thing is the other half. A test is just a known input paired with the output you expect: run it, compare, and you have proof instead of hope.

When a program does the wrong thing, Devlish lets you trace it. Because execution is deterministic, every run produces the same ordered record of what happened: each value assigned, each decision taken, each line printed.

Run the program below. It prints B. Now click show execution trace under the output and read the steps: you can see the score being stored and the comparison being made. Change score to 95, run again, and watch both the output and the trace change.

Try it in your browser

Run it, then click "show execution trace" beneath the output to see every step the program took.

Takeaway

A test turns hope into proof; a trace turns a mystery into a list of steps. Deterministic execution is what makes both of them reliable, which is the whole point of running rules that matter.