A working loop with three steps: red (write a small test that fails), green (write the least code that passes), refactor (clean up while the tests stay green). You repeat it in small steps.
TDD
Test-driven development: write a failing test, make it pass, then clean up (red, green, refactor).